DUA WHEN SOMEONE SEES THE DEAD
The Holy Prophet (s) is reported to have said that whoever sees a funeral procession and says these words, all the angels in the heavens will weep as a sign of showing mercy to him:

Imam al-Sadiq (‘a) is reported to have instructed the bearers of a coffin to say these words:

Imam Zayn al-’Abidin (‘a) is reported to have used to said these words whenever he would see a funeral procession:

It is not traditional that women follow funerals. It is also discommended for those who follow a funeral to laugh or to utter nonsensical words.
In his book entitled al-Hilyah, ‘Allamah al-Majlisi, may Allah have mercy upon him, quotes the Holy Prophet (s) as saying, “Whoever performs a prayer for a deceased, seventy thousand angels will pray for him and Almighty Allah will forgive him his past and coming sins. If he remains until the deceased is buried and soil completely covers his grave, then he will be granted a carat of reward for each step he has made. One carat is equal to the weight of Mount Uhud.”
The Holy Prophet (s) is also reported to have said, “Any faithful believer who performs a prayer for a deceased person will be awarded Paradise incumbently unless he is hypocrite or impious to the parents.”