This was your first dog loss, I take it. And you are young. You are not alone, my dear. Every dog owning human who's spent their life in the company of dogs has lost 'a first dog' like you just did.
That first dog loss is by far the hardest, because it's a first. I've lost 5 dogs during my life thus far and each and every single one of them was completely tragic and it hurt my heart a lot. ... No, you are NOT alone.
Simple honest truths can be comforting to you if you let them:
Your dog lived a blessed, long life with a family who loved him completely. That is a blessing.
Your dog did not suffer when he left. YOU did, but it was quick for him. That is a blessing.
Your dog died surrounded by love and those who loved him. That is a blessing.
Your life has been changed for the better for having had this dog in your life. That is a blessing.
When any being enters the dieing process, other systems begin shutting down. Your dog heard you, for sure, but did it affect him while he was dieing? Probably not. Dieing takes all your attention till attention is gone. You gave him your love as he was leaving ~ that's huge. Good job and I applaud you for being there with him as he left ~ that is very hard to do for some people. You deserve a hug for your efforts. You have nothing to lament yourself over ~ your dogs spirit will hold no grudges, you shouldn't either.
You DID get to say goodbye to your dog ~ you were with him. You did just right. Smile and know that your dog loves you, too. And above all, forgive yourself and any other negativity you are harboring surrounding your dogs death as it won't fix a thing, but it will hurt your healing. Give yourself a break.
This is a time of great sorrow for you. There are no shortcuts through this journey full of tears and and pain. Allow yourself to grieve fully as that is what ultimately opens your spirit to healing.
My 1st dog came into my life when I was 4 and left when I was 22. That dog was 18 years old when he passed ~ I was an adult, but had known and loved that dog for nearly ALL of my life up to that point. I absolutely know what you're going through and you have my sympathies.
You will survive this. You will grow. That next dog coming into your life will be so well loved and fortunate for the journeys you've had. You're a better person for having lived this. I won't promise that it gets easier as each dog is different and each brings a whole new story unique to the two of you. Some will be easier ~ some will be much harder ~ but you will get through for having been there before.... like me and many others.