Most recommendations for what to do in this situation involve reskilling, or improving specific skillsets you already have. While I don't think this is quite wrong, I do think it's a misunderstanding of the issues at hand.
For one, nobody knows what skills will be valuable going forward because the rate of change within the economy is so rapid. What's valuable now may not be worth much by the time you get a degree or finish a long certification program.
Second, the entire idea that skills alone are what propel you forward is misguided in my opinion. From my own anecdotal experience, I've seen people with very few definable skills make it very far in life, and I've likewise seen incredibly skilled people fail over and over again.
Yes, if you're the best ML engineer on the planet, you will be fine—but the number of people who even get the opportunity (which requires a whole lot of time, money and natural talent) to develop those kinds of skills to a world-class level is bound to be tiny. For everyone else, the solutions aren't so simple.
Mixing Tangible Skills with Intangibles
My personal belief is that the most valuable skillsets moving forward will be mixes of tangible skills and the intangible ability to combine things from different domains. This allows for personal differentiation and a chance to avoid getting turned into a nameless, shapeless cog in the AI-driven future.
So, with all that being said, the rest of this section is dedicated towards pointing you in the right direction more than anything else. There aren't any easy answers here, but the concepts that follow will at least put you in a place to consider what your real options are.