The Messenger of Allah ﷺ said, "Whoever joins a funeral procession from the deceased's family and walks with it until the prayer is performed will receive one qirat of reward. Whoever waits until the burial is completed will receive two qirats, each like the mountain of Uhud."
حدثنا سليمان بن داود حدثنا وهيب عن عمرو بن يحيى الأنصاري وأبو سلمة حدثنا سليمان بن بلال عن عمرو بن يحيى عن محمد بن يوسف بن عبد الله بن سلام
عن رسول الله ﷺ قال من جاء إلى جنازة فمشى معها من أهلها حتى يصلى عليها فله قيراط ومن انتظر حتى تدفن أو يفرغ منها فله قيراطان مثل أحد
Its chain of transmission is sahih. Via the first and second route it is hasan, because of Muhammad bin Yusuf bin Abdullah bin Salam. Abu Salama is Mansur bin Salama Khuzai, a trustworthy, firmly reliable, retentive narrator, and he has already appeared at 11065.