Let's take an extreme case. A player says in a moderate volume "Fuck you ref, suck my balls". Moderate volume means that probably 4-6 other players within 10 yards heard it, but no coaches or spectators.
By the book that is a red card for foul and abusive language.
You have some options at this point. You can give the red and be perfectly justified in the report and the eyes of the players and coaches (but they still won't like it), you can give a yellow and tell him he is lucky or whatever justification you want. Or here is what I do. Blow the whistle and say, "Excuse me sir, I didn't quite catch what you said, could you repeat that?". If he repeats it or doubles down, he gets a red and his own teammates are mad at him for being an idiot instead of being mad at you, or he mumbles something else and you say, "oh okay, I thought I heard something else, I understand you don't like my call, but that is the way we are going".
I think my way, you have preserved the integrity of the game, demonstrated to the players that you are not to be trifled with, and in no way have you compromised your authority or management of the game. A straight red starts the howling from the other teammates, a yellow is kind of weak, and doing nothing is just chum in the waters. And that is foul and abusive language, I have other tools for dealing with dissent that stops it in its tracks that I can use before the last resort of a card
Now, if the player makes it loud and public, he has essentially tied my hands and he will get the card according to the law. If he is just publically out of control, I try and give his teammates and captains a chance to calm him down. Giving 2 dissent yellows for the same call is poor. Pull out the yellow indicating that a card is coming, wait for the payer to finish ranting, then raise the yellow and issue it when he is done. Bonus points for calmly writing his number in the book while he is yelling, showing indifference, before showing the card.