This is purely subjective. If someone says this they basically mean “stop talking”. It’s massively rubbish to say it.
If I’m daydreaming & having fun who are you to make such a comment?
If I’m sad & working something out unconstructively, how does saying that help?
So really ‘over thinking’ isn’t a helpful thing to label so generally.
Overthinking is bad if it gets you nowhere & makes you feel awful. Only you can say if you are doing it, noone else should label this for you.
All this wouldn’t be a problem if people asked questions rather…
“Do you think about it too much?” & “What would stop you thinking about it so much?”
Obviously they may say no to the first question, in which case you should endure, like a good sounding board, if they say yes, ask the next question. Just like that you go from being viewed as annoying – to being viewed as nice. Plus you have now said something helpful.