The Messenger of Allah (ﷺ) said: "Whoever has doubt during his prayer, let him prostrate twice after he said the taslim."
Sunan an-Nasa'i Book 13, Hadith 71