Bulugh al-Maram, Book 3, Hadith 592 (English)

Abu Hurairah (RAA) narrated that the Messenger of Allah said, "Hurry up when you carry the dead body (the janazah), for if the deceased is righteous, you would be taking it to something better, and if he or she is an evil person, then you will be getting him or her off your necks.’ Agreed upon.

وَعَنْ أَبِي هُرَيْرَةَ ‏- رضى الله عنه ‏- عَنِ اَلنَّبِيِّ ‏- صلى الله عليه وسلم ‏-قَالَ: { أَسْرِعُوا بِالْجَنَازَةِ, فَإِنْ تَكُ صَالِحَةً فَخَيْرٌ تُقَدِّمُونَهَا إِلَيْهِ, وَإِنْ تَكُ سِوَى ذَلِكَ فَشَرٌّ تَضَعُونَهُ عَنْ رِقَابِكُمْ } مُتَّفَقٌ عَلَيْهِ 1‏.‏ ‏1 ‏- صحيح.‏ رواه البخاري (1315)‏، ومسلم (944)‏ (50)‏.‏

sunnah.com

also referenced under: Book 3, Hadith 36 (In-Book)