Anas bin Malik reported,

The Messenger of Allah ﷺ said, "You should not be impressed by anyone until you see how his life ends. A person may spend a period of his life, or a portion of his time, doing righteous deeds such that if he died upon them he would enter Paradise, then he changes and does evil deeds. And a servant may spend a portion of his time doing evil deeds such that if he died upon them he would enter the Fire, then he changes and does righteous deeds. When Allah intends good for a servant, He puts him to use before his death."The Companions asked, "Messenger of Allah, how does He put him to use?"He replied, "He grants him success in performing righteous deeds, then takes his soul while he is upon them."

Ahmad 12214

Sahih

حدثنا يزيد بن هارون أخبرنا حميد

عن أنس

أن رسول الله ﷺ قال لا عليكم أن لا تعجبوا بأحد حتى تنظروا بم يختم له فإن العامل يعمل زمانا من عمره أو برهة من دهره بعمل صالح لو مات عليه دخل الجنة ثم يتحول فيعمل عملا سيئا وإن العبد ليعمل البرهة من دهره بعمل سيئ لو مات عليه دخل النار ثم يتحول فيعمل عملا صالحا وإذا أراد الله بعبد خيرا استعمله قبل موته قالوا يا رسول الله وكيف يستعمله قال يوفقه لعمل صالح ثم يقبضه عليه

أحمد 12214صحيح
Contents
Reference
Commentary
Ayat
Collection
Musnad Ahmad
Book
Anas bin Malik
Numbering
Darussalam 12214
Ahmad 12214