The Messenger of Allah ﷺ said, "Whoever does not show mercy to people, Allah will not show mercy to him."
قال رسول الله ﷺ: من لا يرحم الناس لا يرحمه الله عز وجل.
Bukhari narrated it in Tawhid (7376) and Muslim in Fadail (2319), both through the route of Amash, from Zayd bin Wahb and Abu Dhubyan, from Jareer bin Abdullah, who said, and he mentioned it. The wording given is that of Muslim, and Bukhari's wording is similar.