Duha prayer is the prayer of those who are penitent, and it is offered as two, or four, or six, or eight raka’hs after the sunrise until close to the time for Dhuhur prayer. Praying it later when the heat is more severe is better, and the evidence for this is:
Zaid ibn Arqam said: The Prophet ﷺ went out to the people of Quba’ and saw them praying, upon this he said: “The prayer of the penitent should be observed when the young weaned camels feel the heat of the sun. Narrated by Muslim 1238
Another narration of Imam Ahmad, on the authority of Zaid bin Arqam: “The Messenger of Allah ﷺ went to the masjid of Quba’ or he entered masjid Quba’ after the Sun had risen and he found them praying, so he said: The prayer of the penitent should be observed when the young weaned camels feel the heat of the sun”.
A narration of Muslim reported from Al Qasim Al shaybani, he said: Zaid bin Arqam saw people praying the duha prayer, so he said: Do they not know that prayer at an hour other than this is better, The Prophet ﷺ said the prayer of the penitent is when the young weaned camel feel the heat of the sun. – Sahih Muslim 1237
An-Nawawi – May Allah have mercy on him- said: The prophet ﷺ said: (The prayer of the penitent is when the young weaned camels feel the heat of the sun), it refers to a time when the temperature of the sand becomes high due to the heat of the sun. This is when the hooves of young camels begin to burn due to the extreme heat of the sun, so they lift their hooves and put them down from the heat of the ground.
Someone who is penitent, is one who returns to the obedience of Allah. It is understood from the narration that the virtue of praying at the time of duha prayer when it is extremely hot which is the best time for praying at that period of the day. Though it is allowed to pray Duha even from when the sun rises to midday. [Explanation of Sahih Muslim by An-nawawi].