I would recommend getting in to see a T (therapist) and be completely honest.
Several years ago, I suffered panic disorder. One of my miserable symptoms was obsessing about "evil thoughts" that popped into my head from time to time. The thoughts caused me so much more anxiety, I recall seriously questioning my mental health at that time. My T explained that my thoughts were dark and scary, yes. But, the healthy part was that I recognized the darkness. I certainly wasn't going to act upon the thoughts. I wasn't "evil" afterall. Just a bit obsessive as I worked through my panic disorder.
I'm not diagnosing you, of course. I just wanted to share my tidbit to reassure you. I understand very well the sense of panic that overcomes you as dark thoughts occasionally enter your mind.

Very best wishes to you!