The Messenger of Allah ﷺ said, "Whoever loves to meet Allah, Allah loves to meet him, and whoever hates to meet Allah, Allah hates to meet him."Someone asked, "Messenger of Allah, is hating to meet Allah the same as hating to meet death? For all of us hate death."He replied, "No, that is not what is meant. Rather, it is at the time of death. When a person is given glad tidings of Allah's mercy and forgiveness, he loves to meet Allah and Allah loves to meet him. But when he is given tidings of Allah's punishment, he hates to meet Allah and Allah hates to meet him."
حدثنا يحيى بن خلف أبو سلمة حدثنا عبد الأعلى عن سعيد عن قتادة عن زرارة بن أوفى عن سعد بن هشام
أن رسول الله ﷺ قال من أحب لقاء الله أحب الله لقاءه ومن كره لقاء الله كره الله لقاءه فقيل يا رسول الله كراهية لقاء الله في كراهية لقاء الموت فكلنا يكره الموت قال لا إنما ذاك عند موته إذا بشر برحمة الله ومغفرته أحب لقاء الله فأحب الله لقاءه وإذا بشر بعذاب الله كره لقاء الله وكره الله لقاءه
Muslim narrated it in the Book of Remembrance and Supplication, chapter "Whoever loves to meet Allah, Allah loves to meet him... etc," hadith 15/2684, from the hadith of Saeed bin Abu Aruba, with this wording. Bukhari also referenced it in suspended form from this, hadith 6507.