I think I might know what you are talking about, even though I don't want to jump to conclusions but a cold shower might help, if you're a person who now frequently takes showers, try taking a cold shower, not medium or kinda cold. Taking cold showers has been known to reduce stress, and help take people out of things like depression and confusion. I know it will be very difficult to take constant cold showers, but it will help in the long run.
I wish I could help you, but I've got no clue what you're thinking about. I guess just do hobbies to get your mind off it. Or take a nap (if you can fall asleep during the day, that is), taking a nap while listening to classical piano helps me relax and get my mind off things. It might not help, because I don't know what you are thinking about, but I tried.
I have a the same problem too. I saw stuff (nasty stuff) on the internet and it effected me. What my dad told me is when i think about out immediately think of something else. (And if you believe in God ask him to take those thoughts out and ask for forgiveness). Something that i do is find a distraction of some sorts like a game for me it’s a game called Animal Jam i played it a lot and it helps me forget. Another thing is do is I talk to a parent or someone about something else. Another thing you could do is sorta like go back in time and do stuff that might be ‘odd’ to others like for me i started watching care bears unlock the magic and i thought about playing with toys (i don’t why people think it’s weird like I’m in elementary like it’s normal-). Also don’t try so hard like my mom says “you’ll forget about it all kids go through this” it’s true. That’s all the thing i can think about. But still even if you do this it’s gonna take long or a little while to get the thoughts out. Like i told my parents too late so it’s gonna take longer for me but it’s gonna take long. Hope this helps
~ Okayybugsy