I think it depends a lot on what it is you feel or know you did wrong, what is necessary before you can forgive yourself.
However, it does also depend on your state of mind at the time.
Just after a bereavement, I believe most of us regret a lot of things we either did or said, or failed to do or say to the person who has just died, While these may be genuine faults, they are probably exaggerated by our grief and should be view in this light.
Generally, speaking I imagine that we were all taught that forgiving oneself and/or being forgiven by others depends on the following steps:
Acknowledge to yourself that you did something wrong, or that an action you still regard as right caused another person hurt or annoyance.
Apologise to that person. If you cannot bring yourself to say that you acted wrongly (and there are cases were saying so would be untrue) you can and should apologise for having caused the other person distress, or anger.
As children we were taught, at least I was, to promise mummy or daddy that I would not do the same thing again.
As an adult, one realises often that one might very well do the same again in similar circumstances, but one can promise oneself at least to attempt not to do so.
If after doing all this, you still cannot forgive yourself, or stop worrying about what you have done, then either go to confession, or consult a psycologist, according to whether you are religious or not.
Harbouring guilt or resentment wthether against others or against yourself does absolutely no good, and indeed may well do you harm. It certainly harms your peace of mind.
The older-fashioned confessors still advise penitents "to avoid the occasion of sin". This is actually sound advice both for believers and non-believers if we take it to mean "Try not to bring yourself in situations were it is all to easy to repeat your mistake."
For example, if you know you say or do unkind things when drunk, then make the attempt to stop drinking to excess.