Many theologians have written about the issue of how we cope with the death of ourselves or loved ones from a religious perspective. Perhaps the most influential book on that subject in the Christian tradition is Boethius' Consolation of Philosophy. Boethius, who has been tortured and is waiting in prison as he is about to be executed, wrote this work to reconcile theodicy (the justice of God) with the existence of misfortune. He imagines Philosophy saying to him:
You are unhappy because you have lost those things in which you took pleasure? But you can also take comfort in the likelihood that what is now making you miserable will also pass away.
In other words, if we are unhappy because we lost loved ones, one need to think that this unhappiness is caused by the joy of having had them -- and that we cannot wish away the pain of the loss without also wishing away the joyous part of the experience. Also, even if loved ones no longer exist as physical beings, they still exist in our memory, and we can continue to derive joy from the memory of past happiness.
When a loved one dies, you can be assured that they are living a much better life in heaven, in total joy and happiness, and that sometime soon you're going to see them again.
Death is just an entrance into eternal life.
If you've lost someone you loved dearly, always remember that God is there and He will comfort you. Matthew 5: "blessed are those who mourn, for they shall be comforted".
"God will wipe away every cheek from their eyes."