I heard from several companions of the Prophet ﷺ, among them Umar, who was the dearest of them to me, that the Messenger of Allah ﷺ forbade prayer after the dawn prayer until the sun rises, and prayer after the afternoon prayer until the sun sets.
أخبرنا أحمد بن منيع قال حدثنا هشيم قال أنبأنا منصور عن قتادة قال حدثنا أبو العالية
سمعت غير واحد من أصحاب النبي ﷺ منهم عمر وكان من أحبهم إلي أن رسول الله ﷺ نهى عن الصلاة بعد الفجر حتى تطلع الشمس وعن الصلاة بعد العصر حتى تغرب الشمس
Muslim recorded it in the chapter on prayer for travelers, section on the times when prayer is prohibited, no. 826, from the hadith of Hushaym. Bukhari recorded it in the chapter on the times of prayer, section on prayer after Fajr until the sun rises, no. 581, from the hadith of Qatada with the same chain.