The Prophet ﷺ said, "Allah the Exalted 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 remembers Me in a gathering, I remember 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 at speed.'"
قال النبي ﷺ: يقول الله تعالى: أنا عند ظن عبدي بي، وأنا معه إذا ذكرني، فإن ذكرني في نفسه ذكرته نفسي، وإن ذكرني في ملأ، ذكرته في ملأ خير منهم، وإن تقرب إلي بشبر تقربت إليه ذراعا، وإن تقرب إلي ذراعا تقربت إليه باعا، وإن أتاني يمشي أتيته هرولة.
Bukhari reported it in the Book of Tawhid (7405), and Muslim in the Book of Remembrance and Supplication (2675), both of them through the route of Amash, who said, I heard Abu Salih, from Abu Hurairah, and he mentioned it.