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 hereafter."During the illness in which he passed away, he was overcome by 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.

Bukhari 4586

Sahih

حدثنا محمد بن عبد الله بن حوشب حدثنا إبراهيم بن سعد عن أبيه عن عروة

عن عائشة رضي الله عنها قالت

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

البخاري 4586صحيح
Contents
Reference
Commentary
Ayat
Collection
Sahih Bukhari
Book
Tafsir
Chapter
Those are with those upon whom Allah has bestowed favor from among the prophets
Numbering
Darussalam 4586
Bukhari 4586