Sayyiduna Abu Hurairah (may Allah be pleased with him) narrates that a funeral passed by the Noble Prophet (peace and blessings of Allah be upon him), so he stood up and said: "Stand up! For indeed, there is anxiety in death."
Hadith Referenceسلسله احاديث صحيحه / المرض والجنائز والقبور / 1659
Ala bin Abdur Rahman narrates from his father that he attended a funeral, Marwan led the funeral prayer, and Sayyiduna Abu Hurairah (may Allah be pleased with him) and Marwan went and sat in the graveyard. Sayyiduna Abu Saeed Khudri (may Allah be pleased with him) came and said to Marwan: "Show me your hand." He handed his hand to him. He said to him: "Stand up." So he stood up. Then Marwan said to Abu Saeed: "Why did you make me stand up?" He replied: "When the Messenger of Allah (peace and blessings be upon him) saw a funeral, he would stand until it had passed by and would say: 'Death is a terrifying thing.'" Marwan (for confirmation) said: "O Abu Hurairah! Is Abu Saeed telling the truth?" He said: "Yes." Marwan said: "Then why did you not narrate this hadith to me?" Sayyiduna Abu Hurairah (may Allah be pleased with him) replied: "You are the ruler, you sat down, and seeing you, I also sat down."
Hadith Referenceسلسله احاديث صحيحه / المرض والجنائز والقبور / 1660
It is narrated from Sayyiduna Abdullah bin Abbas (may Allah be pleased with them both) that the Prophet Muhammad (peace and blessings be upon him) stood up for a funeral, and it was the funeral of a Jew, and he said: "Its stench caused me discomfort, so I stood up."
Hadith Referenceسلسله احاديث صحيحه / المرض والجنائز والقبور / 1661