I've practised Shotokan karate for twenty three years. I train and teach three times a week. Our training sessions are ninety minutes long and I can honestly say that, for ninety minutes three times a week, I think of nothing but karate, no matter what else is going on in my life. It's very restful. If I'm finding it hard to sleep, I practise a kata or two in my mind. It really helps. Karate is a brilliant activity. It's physical exercise, both aerobic and anaerobic, but it's also mental exercise because you never stop learning and refining, so you don't get bored, as you might with the gym or with other mindless exercise e.g. aerobics or zumba. Karate is also sociable. Everyone is like minded and friendly. You can go at your own pace too.
So, my advice is to look for an absorbing hobby, preferably something you can learn and practise with others but also independently, something that requires concentration. It doesn't have to be physically demanding. You can get that by other means. It's the commitment to something you can learn, and keep learning (for twenty three years and more!) that helps to exclude negative thoughts.
Be creative.
Learn a language (there are free on line courses at FutureLearn and a 'community')
Learn to paint or sculpt.
Learn to sew, knit, crochet, throw pots, screen print... (Eye test and glasses of necessary!)
Volunteer.