Abu Juhaym reported,

"What did you hear from the Messenger of Allah ﷺ concerning a man passing in front of another while he is praying?"He replied, "I heard the Prophet ﷺ say, 'If any of you knew what is held against him for passing in front of his brother while he is praying, standing still for forty would be better for him than that.'"The narrator said, "I do not know whether he said forty years, forty months, or forty days."

Ibn Majah 945

Sahih

حدثنا علي بن محمد حدثنا وكيع حدثنا سفيان عن سالم أبي النضر عن بسر بن سعيد أن زيد بن خالد أرسل إلى

أبي جهيم الأنصاري يسأله

ما سمعت من رسول الله ﷺ في الرجل يمر بين يدي الرجل وهو يصلي فقال سمعت النبي ﷺ يقول لو يعلم أحدكم ما له أن يمر بين يدي أخيه وهو يصلي كان لأن يقف أربعين قال لا أدري أربعين عاما أو أربعين شهرا أو أربعين يوما خير له من ذلك

ابن ماجه 945صحيح
Contents
Reference
Commentary
Ayat
Collection
Sunan Ibn Majah
Book
Establishing prayer and the sunnah regarding it
Chapter
Passing in front of someone praying
Numbering
Darussalam 945
Ibn Majah 945