The Messenger of Allah ﷺ said that Allah says, "I am as My servant thinks of Me, and I am with him whenever he remembers Me. If he remembers Me within himself, I remember him within Myself. If he mentions Me in a gathering, I mention him in a better gathering. If he draws near to Me by a hand's span, I draw near to him by a cubit. If he draws near to Me by a cubit, I draw near to him by an arm's length. And if he comes to Me walking, I come to him running."
حدثنا عفان قال حدثنا عبد الواحد قال حدثنا سليمان الأعمش قال حدثنا أبو صالح قال سمعت
قال رسول الله ﷺ قال الله عز وجل أنا عند ظن عبدي بي وأنا معه حين يذكرني إن ذكرني في نفسه ذكرته في نفسي وإن ذكرني في ملإ ذكرته في ملإ خير منه ومن تقرب إلي شبرا تقربت إليه ذراعا ومن تقرب إلي ذراعا تقربت إليه باعا ومن جاءني يمشي جئته مهرولا
Its isnad is sahih. Bukhari reported it, 9/147, in the Book of Tawhid, chapter on what is mentioned regarding the Divine Essence and Attributes, and Muslim, 4/2061, no. 2675, in the Book of Remembrance, chapter on encouragement to remember Allah.