Failure feels heavy, especially when a lot was riding on something, but how you respond to it matters far more than the failure itself, and almost every successful person has a trail of failures behind them that you never see. The first thing to know is that failing at something does not make you a failure as a person. It is an event, not your identity, and separating the two protects both your confidence and your ability to bounce back.
Allow yourself to feel disappointed for a while, because pretending it does not hurt is not strength. But do not let that feeling harden into a story that you are not good enough. After the initial sting, shift into learning mode. Look honestly at what happened and ask what you can take from it, what you would do differently, and what was outside your control. This turns a painful experience into useful information, which is exactly what separates people who grow from setbacks from those who are crushed by them.
Then take one small step forward, because action is the best cure for the helpless feeling failure brings. Make a simple plan, focus on what you can control next, and keep moving. Talk to people you trust, since sharing lightens the weight and they often remind you of strengths you have forgotten. Remember that many setbacks that feel like the end of the road turn out to be detours that led somewhere better. Be as kind to yourself as you would be to a friend in the same situation, and give yourself credit for continuing, because getting back up is the real achievement.
Example: A student who fails an important exam and, after some honest reflection, adjusts how they study and tries again often ends up stronger than if they had passed easily the first time.
One practical tip: Separate the failure from your self worth. It is one event, not a verdict on you. Learn from it, take one small next step, and keep moving.