All perfect praise be to Allah, The Lord of the Worlds. I testify that there is none worthy of worship except Allah, and that Muhammad is His slave and Messenger.
The prayer is not invalidated by reciting the opening supplication for the prayer in the third Rak’ah, and it does not also necessitate prostration for forgetfulness.
Indeed, the jurists stated that if a praying person recites a legislated Thikr (mention of Allah) in prayer at a position other than its proper place, then it is not obligatory for him to prostrate for forgetfulness; rather, it is only desirable for him to do so.
For more benefit, please refer to Fatwa 349990.
Allah knows best.