The Messenger of Allah ﷺ left Ali bin Abu Talib behind during the expedition of Tabuk.Ali said, "Messenger of Allah, are you leaving me behind with the women and children?"He replied, "Are you not content to be to me what Harun was to Musa, except that there is no prophet after me?"
خلف رسول الله ﷺ علي بن أبي طالب في غزوة تبوك، فقال: يا رسول الله، تخلفني في النساء والصبيان؟ فقال: أما ترضى أن تكون مني بمنزلة هارون من موسى، غير أنه لا نبي بعدي.
Bukhari narrated it in the Merits of the Companions of the Prophetﷺ (3706), and Muslim in the Merits of Ali bin Abu Talib (2404), both of them from Muhammad bin Bashshar, who said, Muhammad bin Jafar Ghundar told us, Shubah told us, from Hakam, from Musab bin Saad bin Abu Waqqas, from Saad bin Abu Waqqas, and he related it, and the wording given is that of Muslim. Bukhari did not mention, "except that there is no prophet after me," but he did mention it in the Military Expeditions (4416) through another route from Shubah, with a chain matching Muslim's wording.