Hi Jenna,
My go-to technique, particularly with older residents who are behaving irrationally, is actually the same as it was when I taught young children: speak to them calmly but sternly and use the tone of your voice to convey authority, looking them straight in the eye. This will usually get them to realize that you can't be bullied, and they are a little embarrassed and change their tone almost immediately. More than once I've said something like, "I know you're angry, but there's no need to shout/be rude."
With residents who are in their twenties through fifties, the better technique is to pause a moment before answering them and speak in a lowered voice, again looking straight in the eye. Usually when you speak in a lower voice they will stop shouting and/or swearing.
In either case, if the resident has a legitimate gripe, the best way to start is to say, "you're right, that shouldn't have happened. Here's what we are going to do right now to fix it." Whatever you do, match the converse of the resident's behavior: the angrier they are, the calmer and more even you should be while taking control of the situation.