Sahih Muslim 3344
The Book of Pilgrimage
حَدَّثَنِي زُهَيْرُ بْنُ حَرْبٍ، حَدَّثَنَا عُثْمَانُ بْنُ عُمَرَ، أَخْبَرَنَا عِيسَى بْنُ حَفْصِ بْنِ عَاصِمٍ، حَدَّثَنَا نَافِعٌ، عَنِ ابْنِ عُمَرَ، قَالَ سَمِعْتُ رَسُولَ اللَّهِ صلى الله عليه وسلم يَقُولُ " مَنْ صَبَرَ عَلَى لأْوَائِهَا كُنْتُ لَهُ شَفِيعًا أَوْ شَهِيدًا يَوْمَ الْقِيَامَةِ " .
Ibn 'Umar (Allah be pleased with them) reported Allah's Messenger (ﷺ) as saying:He who patiently endures the hardships of it (of this city of Medina), I would be an intercessor or a withness on his behalf on the Day of Resurrection
Text from the public-domain hadith-api dataset. Numbering follows that dataset and can differ by a few from some printed editions — check the wording, not only the number.