Abu Hurayrah reported, tracing it back to the Prophet ﷺ, who said, "Hasten with the funeral. If the deceased was righteous, then it is good that you are bringing them forward to it. If it was otherwise, then it is an evil that you are putting down from your necks."
حدثنا مسدد حدثنا سفيان عن الزهري عن سعيد بن المسيب
يبلغ به النبي ﷺ قال أسرعوا بالجنازة فإن تك صالحة فخير تقدمونها إليه وإن تك سوى ذلك فشر تضعونه عن رقابكم
Bukhari narrated it in the Book of Funerals, Chapter on hastening with the funeral bier, hadith no. 1315, and Muslim in the Book of Funerals, Chapter on hastening with the funeral bier, hadith no. 944, from the hadith of Sufyan bin Uyayna through this same chain.