Jami` at-Tirmidhi Book 10, Hadith 79
The Messenger of Allah said: "Whenever you see a funeral (procession), stand up (for it). Whoever follows it, then do not sit down until it is put down."
The Messenger of Allah said: "Whenever you see a funeral (procession), stand up until it goes ahead of you or it is put down."
"The Messenger of Allah (ﷺ) stood, then (later) he sat". (Sahih)
There are narrations on this topic from Al-Hasan bin 'Ali, and Ibn 'Abbas.
Abu Eisa said: The Hadith of 'Ali is a Hasan Sahih Hadith, regarding which there are narrations from four of the Tabi'in narrating it from each other. This is acted upon according to some of the people of knowledge. Ash-Shafi'i said: "This is the most correct thing on this topic" This Hadith abrogates first Hadith: "Whenever you see a funeral (procession), stand up ."
Ahmad said: "If he wants, he stands, and if he wants, he does not stand." His proof is that it has been reported that the Prophet (ﷺ) stood, then sat, and this is what Ishaq bin Ibrahim said.
(Abu Eisa said:) As for the saying of 'Ali: The Prophet (ﷺ) stood for the funeral and then sat, he means that the Prophet (ﷺ) would stand when he saw a funeral (procession), then he did not do so later, so he would not stand when he saw the funeral (procession).