One day you will realize or remember that something you once said or did to another human being caused that person harm and pain. You will be ashamed and sorry, and you will wish that you could take it back.
You cannot. But you can do something to address what happened, something that can help you and that person too.
In Twelve Step recovery this is called "making amends." To amend means to change, so changing your behavior and never doing that hurtful thing again is a lot more meaningful than just saying you are sorry. But apologies count too.
You can go to the person or maybe write to that person and sincerely tell them how sorry you are for your words, actions, or inaction, whatever the case may be. You can say, "I am so sorry, and I want you to know that, and I want you to know that I have changed." Here's the thing: that person may or may not be open to hearing your apology, and even if they do, they may not be ready or willing to forgive you.
That's okay, and you will just need to let that be. Still, you will feel a great burden lift just for having made the effort.