The Messenger of Allah (ﷺ) said: "Whoever has doubt during his prayer, let him prostrate twice." (One of the narrators) Hajjaj said: "After he has said the taslim." (Another of them) Rawh said: "While he is sitting."
Reference: Sunan an-Nasa'i 1251 In-book : Book 13, Hadith 73 English translation : Vol. 2, Book 13, Hadith 1252
Help us gift a modern, ad-free Islamic application for the Muslim Ummah. Your donation will be recorded as Sadaqah Jariyah in your book of deeds, In Sha Allah.