Death is the only certainty in life, and the one thing nobody prepares for until it overtakes them nor think about until it claims a loved one.
It is said that when the soul dies, it is at first unaware of its death / removal from the physical world. It still perceives the actions of loved ones and feels their pain. It lingers behind trying to communicate with them and reassure them that there is nothing to cry about. We the bereaved need to let them go on their way into the afterlife / purgatory / next life as is our belief.
In Vedic thought, we have the Mrintyunjaya (Victory over death) Manthra from the Rig Veda which in Sanskrit is written as
ॐ त्र्यम्बकं यजामहे सुगन्धिंम् पुष्टिवर्धनम् ।
उर्वारुकमिव बन्धनान् मृत्योर्मुक्षीय मामृतात्
Om tryambakam yajāmahe sugandhim puṣti-vardhanam ǀ
urvārukam-iva bandhanā mṛtyormukṣīya māmṛitāat
OM. We worship the Three-eyed Lord Who is fragrant and Who nourishes and nurtures all beings. As the ripened cucumber (with the intervention of the gardener) is freed from its bondage (to the creeper), may He liberate us from death for the sake of immortality.