Ayesha reported,

I heard the Messenger of Allah ﷺ say, "No prophet falls ill except that he is given the choice between this world and the next."During the illness in which he passed away, he developed severe hoarseness, and I heard him say, "With those whom Allah has favored of the prophets, the truthful, the martyrs, and the righteous" [Nisa 4:69]. So I knew that he had been given the choice.

Azami 12177

Sahih

عن عائشة قالت

سمعت رسول الله ﷺ يقول: ما من نبي يمرض إلا خير بين الدنيا والآخرة، وكان في شكواه الذي قبض فيه أخذته بحة شديدة، فسمعته يقول: {مع الذين أنعم الله عليهم من النبين والصديقين والشهداء والصلحين} فعلمت أنه خير.

الأعظمي 12177صحيح
Contents
Reference
Commentary
Ayat
Collection
Jami al-Kamil
Book
Tafsir of the great Quran
Chapter
Virtues of Surah Baqarah
Section
His saying, "And whoever obeys Allah and the Messenger, those will be with the ones upon whom Allah has bestowed favor of the prophets, the steadfast affirmers of truth, the martyrs, and the righteous. And excellent are those as companions"
Numbering
Jami al-Kamil 12177 (2nd edition)
Azami 12177