Sahih Muslim, Book 11, Hadith 64 (Muslim 2164)

Abu Huraira reported Allah's Apostle (ﷺ) as saying:

Make haste at a funeral; if the dead person was good, it is a good state to which you are sending him on; but if he was otherwise it is an evil of which you are ridding yourselves.