Anas bin Malik reported,

A funeral procession passed by, and the people spoke well of the deceased. The Prophet ﷺ said, "It has become certain."Then another funeral passed by, and the people spoke ill of the deceased. He said, "It has become certain."Umar bin Khattab asked, "What has become certain?"He replied, "This one whom you praised, Paradise has become certain for him, and this one whom you spoke ill of, the Fire has become certain for him. You are Allah's witnesses on earth."

Azami 3640

Sahih

عن أنس بن مالك قال

مروا بجنازة فأثنوا عليها خيرا فقال النبي ﷺ: وجبت ثم مروا بأخرى فأثنوا عليها شرا فقال: وجبت فقال عمر بن الخطاب: ما وجبت؟ قال: هذا أثنيتم عليه خيرا فوجبت له الجنة، وهذا أثنيتم عليه شرا فوجبت له النار، أنتم شهداء الله في الأرض.

الأعظمي 3640صحيح
Contents
Reference
Commentary
Ayat
Collection
Jami al-Kamil
Book
Funerals
Chapter
Deceased, carrying the funeral bier, and standing for it
Section
Praise of the people for the deceased
Numbering
Jami al-Kamil 3640 (2nd edition)
Azami 3640