Walk out. Get some space from the situation.
Effective communication has stopped once either of you is yelling: no one is really thinking through what they’re saying, and no one is really hearing the other person. So as well as distressing, it’s also completely pointless.
Leaving doesn’t need to be dramatic. It’s not a punishment, it’s barely even a statement (beyond “I don’t want to be here anymore”). It’s just exiting the situation.
Walking out gives you a chance to get your breathing regulated again (if necessary, keep walking for about 10 minutes, even if you’re going in circles, to force the body to regulate). It stops the pointlessness of 1 person screaming at another. It brings things back into perspective: whatever we were trying to talk about, we weren’t doing it effectively, so the conversation either doesn’t need to happen, or it needs to happen in a different way. And it makes it clear for everyone involved (including ourselves) that I don’t do this anymore. Tolerating being yelled at isn’t something I do now.
It cuts both ways. People will keep yelling at us if that’s how we communicate with them.
There’s some really useful things to learn about assertive communication for folks (like me) who have a history of interpersonal trauma - how to actually communicate with people in an effective way, which includes when people are talking to us, as well as how we talk to them.