If someone swears at me I immediately stop helping them and tell them to leave. If they don't, pick up the phone and threaten to call the police and follow through if they keep going off.
Sometimes I've wished angry customers would swear at me so I could do this.
Pissed off yelling is w/e, you can't shut them out over that.
But let one swear word come out and they're done, no boss can say shit to you about washing your hands of that situation.