The Messenger of Allah ﷺ said, "Whoever follows a funeral procession until the prayer is performed over the deceased earns one qirat of reward, and whoever waits until the burial is complete earns two qirats."
قال حدثنا أبو النضر قال حدثنا المبارك عن الحسن
قال رسول الله ﷺ من تبع جنازة حتى يصلي عليها فله قيراط ومن انتظرها حتى يفرغ منها فله قيراطان