Answer
I say, and with God's success: The obligatory prayer, the prostration of recitation, and the funeral prayer are not valid when the sun is yellowing and weak - to the extent that the eye can look at it - until it sets, except for the afternoon prayer of that day, for it is not prohibited to perform it at sunset, nor is it disliked to perform it at that time; because he performed it as it was required; since the reason for the obligation is the end of the time if it is not performed before it, otherwise it is the part connected to the performance, so he performed it as it was required, thus it is not disliked to perform it then, but it is disliked to delay it until then; as narrated by Uqbah ibn Amir Al-Juhani, may Allah be pleased with him, who said: "There are three times when the Messenger of Allah, peace be upon him, forbade us to pray in them or to bury our dead: when the sun rises until it is high, when the sun is at its zenith until it tilts, and when the sun is about to set until it sets," in Sahih Muslim 1: 568, Musnad Al-Mustakhraj 2: 424, Sahih Ibn Hibban 3: 348, Sunan Al-Tirmidhi 3: 348, and Sunan Abu Dawood 3: 208. And from Ibn Abbas, may Allah be pleased with both of them, who said: "Witnesses whom I trust testified to me, and the one I trust the most is Umar, that the Prophet, peace be upon him, forbade praying after dawn until the sun rises and after the afternoon until the sun sets," in Sahih Bukhari 1: 211. See: Maraqi Al-Falah, pp. 186-187, and Allah knows best.