Abdullah bin Arqam used to lead his companions in prayer. One day, when the time for prayer arrived, he went to relieve himself and then returned, saying, "I heard the Messenger of Allah ﷺ say, 'When one of you needs to relieve himself, let him do so before the prayer.'"
أخبرنا قتيبة عن مالك
أن عبد الله بن أرقم كان يؤم أصحابه فحضرت الصلاة يوما فذهب لحاجته ثم رجع فقال سمعت رسول الله ﷺ يقول إذا وجد أحدكم الغائط فليبدأ به قبل الصلاة
[Sahih] Reported by Abu Dawud in the Book of Purification, chapter titled "Should a man pray while holding back the urge to urinate?", no. 88, and by Tirmidhi, no. 142, and Ibn Majah, no. 616, from the hadith of Hisham through this route. It is also found in Muwatta (Yahya), 1/159, and in Kubra, no. 925. It was graded sahih by Ibn Khuzayma, Ibn Hibban, Hakim, Dhahabi, and others.Hisham stated explicitly that he heard it directly, as recorded by Ahmad.