I've recently experienced something very similar, I would like to share with you my story on getting (mostly) through it in hope that it may help others.
First step for me, just getting out in the wilderness helped me immensely, even just a nice park and some sun/rain helps. It sounds really alternate but getting out and touching trees, just sitting under them has been a kind of medicine, watching animals in as wild of a setting as possible is nice too.
Walking, or "wandering" for a long period of time has also been a great way to settle the mind, you could call it the most primitive form of meditation, but if you get the chance to walk for 1-2 hours along a quiet beach, consider yourself blessed. Just not having a set place to walk but just exploring is what I mean.
More formal meditation practice is very, very good for me; however, it has to be taught / practiced properly. Getting the wrong idea about something like Buddhism can be quite destructive, especially for those in a vulnerable place.
I found socializing to be critical, if you can talk to someone about the problems specifically it's even better. We are social beings.
My episode I now consider a little bit of a gift, it has made me realize the value of our natural surroundings and how important their conservation, protection and our return to them is for us humans. Maybe more than some of us ever realize.
I read the ancient Greeks would treat people with mental distress by giving them a nice quiet place to stay near the sea, maybe they were onto something?
Some folks find mediation makes them feel worse, depending on the technique and what is going on inside the person's head. Some of the repeated thoughts can happen in depression and anxiety. Meditation combined with either illness can be weird - some folks get a lot out of it, especially if they have comparatively mild symptoms, and some find it makes it go awry, for lack of a better description. Also, for females, hormones can cause sticky thoughts sometimes. This sort of thing might make medication a better first helping choice than meditation.
It might have helped that I stopped carrying a smartphone. I guess things like sitting on a train without any entertainment counts as meditation, although I never really think of it as such.