If you weren't with your loved one when their death occurred, you are now probably thinking about all of the things that would be different if you had been there. You're thinking about how your present life might be very different if you had been with your loved one at their time of death. You might even think you could have prevented it from happening. "I could have done more, " "If only I had gone for a visit earlier/later in the day," "I should have stayed with him/her and not gone on my trip," "Why didn't I encourage her/him to fight the illness/disease more?"
I played that game for months after my husband died and then I finally came to the realization that I really was doing everything, and I mean everything, that I could to keep my husband healthy. It was not a sudden thought that hit me instantly. It was more of a gradual understanding of the cumulative effect of the things I was doing and what was happening to him medically.
You never have control over the other person's situation and you can't beat yourself up over your inability to own it. You will feel guilty for awhile but you should only let yourself feel that way for a short amount of time. Set a date and tell yourself you're going to start working on letting it go. You have to tell yourself -- because it's true -- that whatever you were doing at the time was the right thing to be doing at that moment. Otherwise, you wouldn't have been doing it. You are only letting "woulda, shoulda, coulda" roll around in brain because you are able to exercise the knowledge of hindsight. Now, looking back, it is so easy to say, "I should have done it another way."
But would you really have done it another way? Probably not. You have to make peace with it and let it go.
More importantly, your loved one wouldn't want you to feel like this. If you said something to your loved one that you regret, that is very human and very understandable. To rid yourself of those regrets, you can always go to a place where you feel close to that person and have a "talk" with them to tell them you're sorry about what you said or you could write them a note explaining why you said what you did and how you would never have said those words had you known they would be the last words spoken to them.
I am lucky. I have no regrets about my last words to my husband and that gives me some peace.