I apologise now that i will not be stating how sorry i am for your loss ect ect as the subject of your post is "How do you deal with it?" Therefore my reply will attempt to give you some insight in how I deal with such things.
I have not owned a dog before i now have a 1 Year old black Lab called Daisy with any luck my time of 'coming to terms' with her death is far away.
I am not however talking to you from inexperience. In my life i have had 4 cats, 2 hamsters, about 9 fish (but they count as 1 pet collectively i say), 1 snake, 2 ducks and a Sugar Glider (look 'em up on youtube). None of the above our in this world today so I have had experience with death of a loved pet.
Id like to think i am quite a sensitive person and as a result the death of the first few beloved animals hit me really hard, almost on par with the death of a human family member....almost. After the first few times i decided it was certainly time to come up with some way of dulling the pain.
So my advice to you is this. Look at the purchase of your pet differently. I have got Daisy with the strong view that I have bought a dog to make my life more enjoyable. I have not bought Daisy to make it better, i have bought a DOG. This is not to say i will pay her less love and attention as it seems especially with dogs the more love and attention you put in, the better dog you get out. But this is not like a child, everything you do must be selfish, you feed her not so that she will not be hungry but so that you may walk her, you train her not so that she will lead a stable life but so that YOU will enjoy your time with her (or 'it' if you can bring yourself to that level).
This may seem somewhat cold-hearted and to some extent it is but i must stress that there is NO DIFFERENCE in the way you treat your dog, merely the motivation behind it. You still grow to love your pet but when its time here comes to an end, your pain is somewhat dissolved by the thought of simply replacing her/him. Rather than "oh my god im never going to find one like Daisy again" No, you wont, but you never wanted Daisy, you wanted a dog, and there are LOTS of those about.
I hoped this helped and even if you dont agree with any of my statements i hope you find comfort in the fact that with enough careful and critical thought the human mind may be trained to handle even the more painful stimuli.
Please do not hesitate to private message me with any further questions.
DO however hesitate to private message me your critisisms of this post, that is what 'reply to thread' is for. It works for me and it eliminates the months of mourning after loosing a loved pet.