When my friend overdosed I was in the same exact room as him.
Wow, that's pretty surreal. Can you tell me what happened?
I went to get some snacks, and when I came back, he was gone
It's good to help your friends when they are in need, and if they are overdosing, you should call 911 immediately.  Doctors and EMTs will not care at all about illegal drugs, they will just try to help.  However, if this happened without your knowledge, then you shouldn't feel responsible, since there was nothing you could have done.
I'm hoping to God that it didn't hurt for him to go that way.
I really hope so too, you were a good friend to spend some of his remaining time together. I'm sure he appreciated all of that.