What he said constantly near the end
Aisha noticed he had started repeating words she had not heard from him before, and asked why.
سُبْحَانَكَ وَبِحَمْدِكَ أَسْتَغْفِرُكَ وَأَتُوبُ إِلَيْكَ
Subḥānaka wa bi-ḥamdik, astaghfiruka wa atūbu ilayk.
“Glory be to You and praise. I seek Your forgiveness and turn to You.”
At the point of the greatest success of his life, the instruction he was given was to ask forgiveness.
Where this comes from
She asked what these words were that he had begun saying. He told her a sign had been appointed for him in his community, and that when he saw it he should say them. Then he recited: when the help of Allah comes, and the victory.
The full narration
A'isha reported that the Messenger of Allah (ﷺ) before his death recited often:Hallowed be Thou, and with Thy praise, I seek forgiveness from Thee and return to Thee. She reported: I said: Messenger of Allah, what are these words that I find you reciting? He said: There has been made a sign for me in my Ummah; when I saw that, I uttered them (these words of glorification for Allah), and the sign is:" When Allah's help and victory..... to the end of the surah
Source
Ṣaḥīḥ Muslim · 1086
- Agreed upon as authentic (al-Bukhārī / Muslim)