Being self-aware enough to notice your thoughts without instantly believing them is key here. For some people, that comes naturally. It might be connected to your home environment. Did your parents model questioning their first reactions? Did they say things like “I keep thinking I left the oven on, but that’s just my anxiety talking”? Or maybe they helped you dispute your own beliefs by leading you through the process: “I know it feels like your friends are excluding you, but can you find evidence to the contrary? Didn’t they work very hard to throw you an awesome party just last week? Why do you think they did that?”
Another way to learn these techniques is to find a good therapist. A professional should be able to quickly suss out any unhealthy thinking patterns. Often, the first course of action is just to notice these recurring thoughts and maybe make a little mark on a piece of paper whenever they come up. Over time, you can replace them with healthier beliefs.
Somebody in that process would know that they have impostor syndrome because they’re aware of thoughts like “I am such a failure”. However, because the thoughts still occur and need to be actively disputed, this same person does still suffer from the accompanying low self-esteem.