As someone with a history of getting overwhelmed emotionally, feeling so terrified, panicked, or angry that I've lashed out and done sometimes irreparable damage to relationships, or so sad that I've been, at times, unable to function, I wrote this list of things to do when I feel that familiar sensation of emotional panic or fear. These are basic emergency instructions for use in the moment. Once you have calmed down sufficiently, what you do in your situation will depend entirely on the situation.
Disclaimer; I am not a medical or psychological professional. This is only advice and has not been tested, vetted, or approved by a medical or psychological professional. Please consider these only suggestions and use them at your own risk.
First Step: STOP. Do nothing. Sit down, if possible, or at least get yourself to a quiet place, if you can, away from the person or situation.
Second Step: Bring your attention to your feet. Place your consciousness there, as if you were in your feet. Feel how they meet the floor or your shoe, pay attention to their temperature. This will ground you.
Third Step: Breathe. Slow your breathing down and take deep, mindful breaths. If you start to get dizzy, breathe normally until the sensation passes. Bring your attention to your breath. Close your eyes, if you want to and it's safe. Keep doing this until you feel the panic subside.
Fourth Step: Drop the story of what has happened. Sit, breathe, and when the thoughts come, think "Thinking" or "Story" and let them go. You can come back to them later. Right now, they do not serve you. Keep doing this, and breathing mindfully, until you feel calmer and can think straight.
Fifth Step: If you're still feeling overwhelmed or panicky, send out love. Imagine your heart as the center of a warm, white light, spreading out in all directions, like ripples in calm water. If you want to and it feels right, say "I send you all my love." If there's one person who you feel has just wronged you, send this out to that person, if you can. It will help you rediscover compassion, which will help in any situation in which you find yourself.