I get this too.
I read a book at bedtime--sometimes I have to read until I'm so tired I literally drop the book after failing to read and comprehend the same paragraph ten or twelve times, so it's almost become a new mental loop but one that puts me to sleep. Sometimes I read until I'm sleepy and it's late and I can turn off the light and go to sleep because the book has interrupted the loop enough that I'm not thinking it anymore. However if Bekafly or NTHubby come talk to me the loop restarts or there's a new loop and I can't get to sleep again. But usually books can get me out of a mental loop.
If it isn't bedtime and I don't have a book or am in a situation where I can't stop and read and I'm having trouble with a loop, especially if it's a loop from a song, the only thing that helps is to sing a long song that I know the whole thing. If I can't sing out loud because of circumstances it doesn't work as well but I go over the whole song in my head. Singing a whole song from beginning to end gets most loops out of my head. But if I only know part of a song--that part of that song just becomes a new mental loop that won't stop and keeps my mind from doing much else.
_________________
Your neurodiverse (Aspie) score: 141 of 200
Your neurotypical (non-autistic) score: 71 of 200
You are very likely neurodiverse (Aspie)
Official diagnosis: Austism Spectrum Disorder Level One, without learning disability, without speech/language delay; Requiring Support