The Messenger of Allah ﷺ said, "Do not deliberately schedule your prayers at sunrise or sunset, for the sun rises between the two horns of Satan. When the upper edge of the sun appears, do not pray until it has fully emerged, and when the upper edge of the sun begins to set, do not pray until it has fully disappeared."
حدثنا يحيى حدثنا هشام بن عروة أخبرني أبي أخبرني
قال رسول الله ﷺ لا تتحروا بصلاتكم طلوع الشمس ولا غروبها فإنها تطلع بين قرني شيطان فإذا طلع حاجب الشمس فلا تصلوا حتى تبرز وإذا غاب حاجب الشمس فلا تصلوا حتى تغيب
Its isnad is sahih. Bukhari related it, 2:48-49, from Musaddad, from Yahya bin Saeed, with this same isnad. Muslim related it, 1:228, through several routes from Hisham bin Urwa, dividing it into two hadiths, as will come divided into two hadiths, 4694, 4695.