The Messenger of Allah ﷺ said, "When a funeral procession passes by you, stand up. And whoever follows it should not sit down until it is placed on the ground."
أخبرنا يحيى بن درست قال حدثنا أبو إسمعيل عن يحيى أن أبا سلمة حدثه
أن رسول الله ﷺ قال إذا مرت بكم جنازة فقوموا فمن تبعها فلا يقعد حتى توضع
Bukhari narrated it in the chapter on funerals, in the section on whoever follows a funeral procession should not sit until the bier is set down etc., hadith 1310, and Muslim narrated it in the chapter on funerals, on standing for the funeral, hadith 77/959, from the hadith of Yahya bin Abu Kathir with the same chain, and it is also in Kubra, hadith 2044.Abu Salama is Ibn Abdul-Rahman, and Abu Ismail is Ibrahim bin Abdul-Malik Qannad.