If the dying person belongs to another religion, encourage them to have faith, to pray, to have positive thoughts, etc. Don't try to impose your own beliefs or try to convert them. If the person has no religion, but seems to be open-minded, you can try to talk about the Dharma. If the person has no interest in religious or spiritual matters, find ways to talk to them that will help them to be free of anger, attachment, fear, etc., and to have a positive, peaceful state of mind. It's good to use some of the person's own money to create merit, e.g. make donations to charity.
Merit accumulated by family members is especially powerful and helpful.
However, once they have taken rebirth, the merit we dedicate may not help them in that life, but could help them in their subsequent rebirth, for example, shortening an unfortunate rebirth. Forms become unclear. Wisdom of equality. Can't remember names. Winds above heart enter into central channel.