The Messenger of Allah ﷺ said, "When Allah intends good for His servant, He hastens his punishment in this world. And when Allah intends evil for His servant, He withholds punishment from him for his sin until He gives it to him in full on the Day of Resurrection."With this same chain of transmission, the Prophet ﷺ said, "The greatness of the reward corresponds to the greatness of the trial. When Allah loves a people, He tests them. Whoever is content receives Allah's pleasure, and whoever is resentful receives His displeasure."
حدثنا قتيبة حدثنا الليث عن يزيد بن أبي حبيب عن سعد بن سنان
قال رسول الله ﷺ إذا أراد الله بعبده الخير عجل له العقوبة في الدنيا وإذا أراد الله بعبده الشر أمسك عنه بذنبه حتى يوافي به يوم القيامة وبهذا الإسناد عن النبي ﷺ قال إن عظم الجزاء مع عظم البلاء وإن الله إذا أحب قوما ابتلاهم فمن رضي فله الرضا ومن سخط فله السخط
[Its chain of transmission is hasan]. Ibn Majah also reported it in the Book of Tribulations, Chapter on Patience in Times of Trial, no. 4031, through the hadith of Layth bin Saad, narrated in the same way. The hadith has supporting narrations in Hakim, 1/349, 4/376, 377, and elsewhere.