The Messenger of Allah ﷺ said, "Whoever has doubt in his prayer should perform two prostrations after giving the salam."
أخبرنا سويد بن نصر قال أنبأنا عبد الله عن ابن جريج قال قال عبد الله بن مسافع عن عقبة بن محمد بن الحارث
قال رسول الله ﷺ من شك في صلاته فليسجد سجدتين بعد ما يسلم
[Its chain of transmission is hasan] Abu Dawud narrated it in the Book of Prayer, chapter on one who speaks after the tasleem, hadith no. 1033, from the hadith of Ibn Jurayj through this route, and he explicitly stated the hearing. It is also found in Sunan al-Kubra, hadith nos. 593 and 1171, and Ibn Khuzayma graded it sahih, hadith no. 1033. Bayhaqi said in 2/336, "This chain of transmission is not problematic."