When a thought is bothering you, you can say that it's weighing on your mind or that it's hanging over you. You may be unable to get it off your mind, or unable to stop thinking about it. An unpleasant image can sometimes stick in your mind.
Does this help?
Student or Learner