Sahih al-Bukhari #1307
Funerals (Al-Janaa'iz) 23:66
Narrated 'Amir bin Rabi`a:
The Prophet (ﷺ) said, "Whenever you see a funeral procession, stand up till the procession goes ahead of you." Al-Humaidi added, "Till the coffin leaves you behind or is put down."