This hadith has been transmitted on the authority of Ibn Umar with a slight variation of wording (and the wording) that Allah's Messenger (ﷺ) said this on the pulpit.
Sahih Muslim Book 44, Hadith 265