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