"Is the practice of the Messenger of Allah ﷺ not enough for you? If any of you is prevented from completing the Hajj, he should perform tawaf around the Kaaba and walk between Safa and Marwa, then leave the state of ihram completely, and perform Hajj the following year, offering a sacrificial animal, or fasting if he cannot find one to offer."
أليس حسبكم سنة رسول الله ﷺ إن حبس أحدكم عن الحج طاف بالبيت وبالصفا والمروة ثم حل من كل شيء حتى يحج عاما قابلا، فيهدي أو يصوم إن لم يجد هديا.
Bukhari related it in the chapter on the one prevented from completing Hajj (1810), via Zuhri, who said, Salim informed me, saying, Ibn Umar used to say (then he mentioned it). Muslim also related it in the chapter on Hajj (1230) through other routes from Ibn Umar, but not with this wording.