The Prophet (ﷺ) as saying: Walk quickly with a funeral, for if the dead person was good it is a good condition to which you are sending him on, but it he was otherwise it is an evil of which you are riding yourselves.
Sunan Abi Dawud Book 21, Hadith 93