What can I do to help a loved one who has just died?

First of all, it should be said that the grief here is often greater than there, that is to say that relatives and loved ones, to a greater or lesser degree, even if they are ignorant of the spiritual life, suffer from the loss. And it is common for those who have left to lament this ignorance of their relatives, and their grief sours their new destiny.
That is why one of the best ways to help a departed loved one, if that is what we intend to do, is to delve deep enough into spiritism to understand that our loved one lives on. In addition to helping us, this will be of great satisfaction to the departed one. On the one hand, they discover the reality and wonders of the new life, leaving behind the difficulties and tribulations of matter, but on the other hand, they suffer when they see their relatives suffering, not being able to do anything to alleviate their pain, except to inspire them that they are still living. And often it is precisely they who lead us to seek the truth.
The state of the spirit who has just disincarnated is hardly something that can be accurately presupposed, but we know that those who have not been truly good and charitable in their existence are going to be in a certain state of turmoil until they awaken to the new reality. And while, generally speaking, the reality of the spiritual plane is better than the one here, there may be certain spirits for whom our sincere help may be beneficial.
We are talking specifically about prayer. Prayers that come from sincere hearts, with one's own words and thoughts, full of feeling, are of great help at such times. They alleviate and mitigate the difficulties of the transition and help the Spirit to adapt to the new reality.
It is for this reason that Allan Kardec tells us that prayers for spirits who have just left the earth are not only intended to give them a testimony of sympathy, but are also intended to aid their detachment, and thus to shorten the disturbance which always follows separation, and to give them more calmness on awakening. But in this, as in every other circumstance, the efficacy lies in sincerity of thought, and not in the abundance of words spoken with more or less pomp, and in which the heart often plays no part.
Prayers that start from the heart, resonate around the Spirit, whose ideas are still confused, like friendly voices that bring us out of sleep.