Now, if you have deliberately lied, or you meant every bit of offense you put into something that you said, it's time to put on your adult pants and deal with the fallout as best you may. Telling the very people you targeted that they "misheard" you or that you never said what everyone blasted well knows you said is either juvenile whining against the blowback or a display of contempt for the intelligence of the people you were deceiving and insulting. If you choose to gaslight others on top of being rude or malicious, on your head be it. But suppose that you have made an honest mistake. What then?
Most of the time, if you have merely made a factual error, simply acknowledging the mistake and correcting it suffices. You can even give a shout-out to the person who cared enough about the matter to bring it to your attention. Unless given good reason to think otherwise, assume the party who pointed out your error acted in good faith, and you'll be the happier for it. Even if you sense a "Gotcha!" attitude, it's still better to take the high road. Honesty and humility will get you much further than a prideful refusal to admit you're wrong.
When you stand accused of moral failure (real or imagined), the situation is much touchier, but again, honesty and humility are your best friends. I am not speaking of groveling before a social media mob or those whose attacks are more about their own sense of self-righteousness than any interest in anyone's actual good. But if you have looked yourself in the mirror as honestly as you are able and have humbly acknowledged any real hurt that you believe that you did---or, if you are honestly holding to deeply held convictions and realize that you cannot deny them without destroying your own integrity or betraying something you hold dearer than your own comfort, your social status, your livelihood, or even your life, no matter how much you wish your stand was not unwelcome or even painful to others---then make whatever apologies you truly believe are needful and stand your ground otherwise with as much wisdom, grace, and courage as you can scrape together for yourself and as much compassion for your enemies as you can muster. If you can remember that even the ugliest things hurled your way come from people who are themselves flawed, broken, and often hurting, you will be one step closer to acknowledging our shared humanity and need for redemption and one step further away from becoming a monster.