Mechanical engineer gets a data engineer job offer

I am a 29 year old mechanical engineer who has strived to get into tech due to the higher compensation. I have an offer from a good company for a data engineer role. However, I see lot of pessimism on the internet regarding layoffs in tech, hiring freeze and replacement by AI. This has generated confusion. I am not able to decide whether to go ahead with the offer or continue with my mechanical engineering job. I am afraid if I would be laid off if I don't perform as good as someone with a CS background or I get replaced by AI. However, the compensation is much higher than what my current role offers. Getting a mechanical engineering job is also tough in case I get laid off. I am putting this here to get the perspective of the market in tech nowadays and a rough forecast for the future. Thanks.