The last words of the Messenger of Allah ﷺ were, "The prayer, the prayer. Fear Allah regarding those whom your right hands possess."
كان آخر كلامه ﷺ: الصلاة الصلاة، اتقوا الله فيما ملكت أيمانكم.
Reported by Abu Dawud (5156), Ibn Majah (2698), and Ahmad (585), all from the hadith of Muhammad bin Fudayl, who said, our teacher Mughira related to us, from Umm Musa, the concubine of Ali, from Ali, and he mentioned it.Its chain is hasan because of Umm Musa, and the discussion of her has already been covered.The way to reconcile the statements of Ali and Ayesha is that Ali's statement refers to the last rulings the Prophet ﷺ spoke about, while Ayesha's statement refers to matters other than rulings, since she was present at his death ﷺ. In both of their statements there is a refutation of the Rafidah, who claim that the Prophet ﷺ bequeathed the caliphate to Ali before his death.