One thing that comes to mind is a technique that falls under the CBT umbrella (Cognitive Behavioural Therapy): Catch It, Check It, Change It (just remember "The Three C's").
Catch It: The first step is just remembering to catch yourself when you're in these "what if" spirals. Literally just realizing what's happening in your own mind and stopping yourself for a moment can be a significant challenge in and of itself. Tell your brain to "STOP", repeatedly if necessary.
Check It: Identify negative thinking patterns. "What if" type thoughts will usually be some form of catastrophizing (worrying about worst case scenarios, exaggerating minor or even manufactured problems), jumping to conclusions (reading people's minds, fortune telling), or all-or-nothing thinking (looking at situations in black-and-white terms while overlooking or discounting the grey in between the extremes).
Change It: Challenge the thought by asking yourself what evidence you have to support what your anxiety is telling you. Focus on the facts. Think about the five senses: If it's not objectively observable by sight, hearing, touch, taste, or smell, then it's only an opinion or a judgement. Use the evidence in the situation to change the thought so that it's more in line with the facts as you know them. (Evidence and facts are an important part of this because they go towards helping you buy into the reframed thought.)
This is only one of many, many different techniques that could be used against anxiety. You could try Googling terms like "CBT techniques for generalized anxiety", or DBT techniques (Dialectical Behavioural Therapy). With DBT, you'd want to read up on the various techniques under its Mindfulness, and Distress Tolerance, and Emotion Regulation components.
Anxiety has a way of misleading your brain, and your brain (which probably feels like your enemy at this point) is doing its best to protect you from danger that's not really there or that's not as bad as it believes. These techniques are meant to help your brain recognize this anxiety for what it is.
Remember to be patient with yourself. Be kind to yourself. One thing all these techniques have in common is that they take a LOT of practice. You will get frustrated. You might feel like a failure with this at times. But keep at it. One day, one step, one thought at a time.