It’s true, believe the other posters when they tell you to pray. Pray & back away from the sin. If you’re near a computer at that time and can get away, walk away from it.
I’ll tell you what helps me when I’m tempted with fear. I hope it will help you, for the temptation you mentioned or any temptation. Start praising Jesus. I do it in a simple way… “Jesus You are holy. Jesus, You are Worthy. Jesus, You are Kindness. Jesus, You are Love. Jesus You are Mercy. Jesus, You are Salvation…” And I keep thinking of things to say (He’s… magnificent, justice, truth, etc, etc). I’ll do that for a few minutes, and the fear, or whatever else, will dissipate and disappear. And I wonder if those feelings go away, not because of distraction, but because the devil & his demons don’t want to stand around having to listen to praises to God. Lol. Oh, I also noticed, that sometimes after I started doing that, temptations or feelings would try to return every few days. But as soon as I realized they were returning again, I’d start praising Jesus again. I tell you, with great happiness, that I’ve been bothered so much less. So much less, in fact, I’m not being bothered anymore. Praise God!
If you find a prayer or something, just remember that your Deliverer delivers you. What I mean is, we find our salvation in Jesus. So if a prayer works for you, do remember to thank Jesus for saving you from temptation and for the gift of prayer, the hope is in Him.
Listening to worship music every day may help, not just as a way to turn from temptation, but as a tool to keep a focus on Jesus every day. (As a side note, I don’t know what kind of music you like, but there is a song that is really helping me to express my love to Jesus right now… it’s called “Holy” by Matt Gilman.) Also, it is very important to be careful about what we ingest… whatever we watch or hear ends up in our memories. So anykind of impurity is out (divert eyes during impure scenes in movies… or just don’t watch the movie, don’t listen to music with impure lyrics). Be on guard. One thing can lead to another, even the smallest thing. And remember… “whatsoever things are true, whatsoever things are honest, whatsoever things are just, whatsoever things are pure, whatsoever things are lovely, whatsoever things are of good report; if there be any virtue, and if there be any praise, think on these things.” Phil 4:8. Fight the good fight, only consume good and pure things for your heart and mind, so that the heart and mind will remain pure… doing the opposite with the shadows of evil can corrupt and hurt, and do all kinds of damage seen and unseen. If only we could see the demonic hag that brings sin to us wrapped up in a golden bow! It’s not something you really want. The temptation that comes to you is not you. Reject anything that comes from the fires of hell. Let your heart burn with a Holy Fire.
I don’t mean to say all that like it’s easy. Still, when tempted, for any sin: Pray (praise Jesus, call out to Him and praise Him), and avoid the sin, literally turning your back on it if you have to. It’s what we all have to do. God bless you, in the midst of the battle, remember Christ is victorious. Run to Him!
God bless you