The Messenger of Allah ﷺ said, "Whoever has doubt about his prayer should perform two prostrations after he gives the salam."
حدثنا أحمد بن إبراهيم حدثنا حجاج عن ابن جريج أخبرني عبد الله بن مسافع أن مصعب بن شيبة أخبره عن عتبة بن محمد بن الحارث
أن رسول الله ﷺ قال من شك في صلاته فليسجد سجدتين بعدما يسلم
[Its isnad is hasan] Nasai reported it in Sahw, chapter on tahri, no. 1251, from the hadith of Hajjaj bin Muhammad, with this wording, and Ibn Khuzayma graded it sahih, no. 1033, and Bayhaqi said in 2/336, "There is nothing wrong with this isnad."