Answered by Sayyidi Habib Umar bin Hafiz (may Allah protect him and benefit us by him)
What dhikr can we give someone who is close to death?
They can recite the following 40 times and then repeat this at intervals:
لا إِلَهَ إِلَّا أَنْتَ سُبْحَانَكَ إِنِّي كُنْتُ مِنْ الْظَّالِمِين
La ilaha illa anta subhanaka inni kuntu min az-zalimin
There is no deity other than You. Transcendent are You. Truly I am one of the wrongdoers.