Narrated 'Amir b. Rabi'ah:The Prophet (ﷺ) as saying: When you see a funeral, stand up for it till it leaves you behind or it is placed (on the ground).
حَدَّثَنَا مُسَدَّدٌ، حَدَّثَنَا سُفْيَانُ، عَنِ الزُّهْرِيِّ، عَنْ سَالِمٍ، عَنْ أَبِيهِ، عَنْ عَامِرِ بْنِ رَبِيعَةَ، يَبْلُغُ بِهِ النَّبِيَّ صلى الله عليه وسلم " إِذَا رَأَيْتُمُ الْجَنَازَةَ فَقُومُوا لَهَا حَتَّى تُخَلِّفَكُمْ أَوْ تُوضَعَ " .
AbuDaud
Funerals (Kitab Al-Jana'iz) • Hadith 3172