In my dhuhr prayer, after standing up for the last rakah, I wasn’t sure if it was my fourth or fifth rakah, however I was somewhat sure it was my fourth, so I continued and completed my prayer, is my prayer valid?

After 1-2 hours of having completed dhuhr, I realized the doubt was still going, is my prayer valid or not?

Doubt in a 4 unit prayers before finishing the Zikr of the second Prostration

If a person doubts during Qiyam (before the Rukoo)as to whether he has offered 4 or 5 units he should sit down at once and finish the prayers and offer 1 unit by standing or 2 units by sitting of Salat-e-Ehtiyat.

If a person doubts while in Qiyam (Before the Rukoo) as to whether he has performed 3rd or 5th unit he should sit down at once and finish the prayers and offer 2 unit by standing of Salat-e-Ehtiyat.

If a person doubts while in Qiyam (Before the Rukoo) as to whether he has performed 3rd, 4th or 5th unit he should sit down at once and finish the prayers and offer 2 unit by standing and 2 units by sitting of Salat-e-Ehtiyat.