A man who had died was mentioned in the presence of the Prophet ﷺ, and the people spoke well of him and praised him. The Messenger of Allah ﷺ said, "It has become certain."Then another man was mentioned in his presence, and the people spoke ill of him and disparaged him. The Prophet ﷺ said, "It has become certain."He said, "You are witnesses over one another."
حدثنا عبد الرحمن عن سفيان عن إبراهيم بن عامر عن عامر بن سعد
أن النبي ﷺ ذكر عنده رجل مات فقالوا خيرا وأثنوا عليه خيرا فقال رسول الله ﷺ وجبت وذكر عنده رجل آخر فقالوا شرا وأثنوا شرا فقال النبي ﷺ وجبت قال أنتم شهداء بعضكم على بعض
Its isnad is sahih, it has occurred many times, and most of the narrations specify that this happened when a funeral procession passed by. See 7543, 389, and 9971.