Sayyiduna Ali bin Abi Talib (may Allah be pleased with him) narrates: Previously (it was the practice of the Prophet ﷺ) that when he saw a funeral, he would stand up; (later, the Prophet ﷺ adopted this practice) that he would remain seated.
Hadith Referenceصحیح ابن حبان / كتاب الجنائز وما يتعلق بها مقدما أو مؤخرا / 3054
Hadith Gradingفضيلة الشيخ الإمام محمد ناصر الدين الألبانيصحيح - «أحكام الجنائز» (100): م.فضيلة الشيخ العلّامة شُعيب الأرناؤوطإسناده صحيح على شرط مسلم