The Prophet ﷺ said, "Visit the sick and walk with funeral processions, for they will remind you of the Hereafter."
حدثنا يحيى عن المثني حدثنا قتادة عن أبي عيسى الأسواري
عن النبي ﷺ قال عودوا المريض وامشوا مع الجنائز تذكركم الآخرة
Its isnad is sahih. Muthanna is Ibn Saeed Dubai, who is trustworthy, and Abu Isa al-Aswari al-Basri, his hadith is accepted by Muslim. Haythami mentioned the hadith in 3/29, and said, "Ahmad and Bazzar narrated it, and its narrators are trustworthy." Bukhari narrated something similar in 9/517, number 5373, in the Book of Foods, regarding the saying of Allah Almighty, "Eat from the good things We have provided for you" [Taha 20:81], and Abu Dawud in 3/187, number 3105, in the Book of Funerals.