Its probably going to be different for each person, but for me its been by working on myself and giving myself reasons to be more confident. Some people hit the gym and work on their appearance, some go to school and work towards a degree some throw themselves into a form of expression they can share like art or something. To be honest that seems to be what most people do. And its hard to take insult/rejection/embarrassment when you already feel bad about yourself.
Taking people and interactions into perspective can help too. One thing I try to remind myself is that there are over 7 billion people on Earth. I could sit and have a conversation with a new person every day for my entire life and still not meet everyone. So if I embarrass myself or get blown off by someone theres tons more. Human beings are not rare here
Also remembering that everyone has things going on that is making life challenging and will probably totally forget about me unless I make it a point to remind them. So if someone says Im a loser one day, Ill more than likely be out of their mind by next week. So its a waste of energy for me to also hold that in my mind. For example, Ive had times where I thought I had a bad interaction with someone at school, stressed about it all week, then worked up the courage to apologize, only to give me a startled look and say "Umm...what are you talking about?".