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.
This hadith has been narrated by another chain of transmitters except with this variation (of words) that in the hadith narrated by Ma'mar (the words are)
" I do not know whether the hadith is marfu'."
Abu Huraira reported Allah's Messenger as saying
Hasten at a funeral, for if (the dead person) is good, you would (soon) bring him close to the good. And if it is otherwise, it is an evil of which you are ridding yourselves.