You are not alone. Many people suffer these intrusive thoughts. I have had intrusive thoughts, my wife has had intrusive thoughts... I thought everyone did. (Lots of long posts, please read through them, these guys are awesome and have great unput.)
The reader's digest version of what works for me is this:
1) Realize it is an intrusive thought, which has no bearing on the real world and ought not influence you in any way.
2) Acknowledge the thought exists, and banish it. Don't store stuff in or bottle it up, you will eventually explode.
3) Find something, like music, motivational quotes, or holy scripture, that replace the void immediately after banishing the thought. Not sure what your thing will be, but if you don't have something to focus on in a positive
way, (depending on the severity and the root of the issue) you can relapse pretty quick.
My wife worked in mental health prior to the kid coming along, and in my work I see a need for improvement world wide in mental health resources. Not sure what the actual correlation between intrusive thoughts and mental health is, but there is definitely a relation.
I used to work at a job that was pretty stressful, back in 2016 and 2017. During that time, stuff happened, (saw things, heard things, got run over by a motorcycle, lost the job, it was great) and as a result I ended up getting some post traumatic stress disorder. Had no idea a ton of little things could build up like that, I thought PTSD was for people who deployed over seas and shot dogs and stuff, but when I sat down with a therapist they had me take a test and sure enough: I had it.
Since then I've come up with this like.... I dunno how I'd describe it... Life foundation, I guess, and when things get off-kilter I default back to the basics. Not gonna get preachy, don't worry. But here is how I figured one can lead a pretty squared away life:
Make sure you have a good, healthy balance in three categories: Physical, Spiritual, and emotional.
1) Physical - take care of your body. For obvious reasons. Wanna feel good you have to, you know, Feel Good
2) Spiritual - not gonna tell you to join a religion or anything, but a basic belief in something bigger than yourself is a fundamental step in basic mental well-being. Do not focus on yourself, focus on other people, and the horrible feelings will begin to fade.
3) Emotional (Also called mental) - A lot of thing affect us every day on an emotional level, even when we don't realize it. (At least that's what my therapist said. As a distant evolutionary cousin to Chuck Norris, I don't actually HAVE emotions, but most people do. XD ) It is important to make sure you have equal amounts of hard work, good fun, and decent sleep. Overdoing one of those categories throws the other two off, and I'm willing to bet causes more than half the mental illness out there.
At the end of the day, you have to take the steps yourself, don't just over-talk it with people, you know? Won't get anywhere just with talk.
So there's my input. You aren't alone, man. I understand quite a few of us here on the 405th suffer some kind of mental illness like depression or OCD or PTSD or all of the above or whatever, and that's fine. I think calling it mental ILLNESS is a little harsh, but the fact of the matter is, we as a group are here to support ourselves, and while it's impossible to meet in person at every bump in the road, many of us are always on and can talk.
Also, just a thought. If you haven't already, watch this video, and do the things he says. This is pretty good:
Keep your stick on the ice. We're all in this together.