In Matthew 25, beginning at verse 31, Jesus is talking about the final judgment. He is saying that on judgment day, we will be separated into two groups, those who cared for those in need, and those who did not.
Jesus says, “But when the Son of Man comes in his glory, and all the angels with him, then he will sit upon his glorious throne. All the nations will be gathered in his presence, and he will separate the people as a shepherd separates the sheep from the goats. He will place the sheep at his right hand and the goats at his left. Then the King will say to those on his right, ‘Come, you who are blessed by my Father, inherit the Kingdom prepared for you from the creation of the world. For I was hungry, and you fed me. I was thirsty, and you gave me a drink. I was a stranger, and you invited me into your home. I was naked, and you gave me clothing. I was sick, and you cared for me. I was in prison, and you visited me.’ Then these righteous ones will reply, ‘Lord, when did we ever see you hungry and feed you? Or thirsty and give you something to drink? Or a stranger and show you hospitality? Or naked and give you clothing? When did we ever see you sick or in prison and visit you?’ And the King will say, ‘I tell you the truth, when you did it to one of the least of these my brothers and sisters, you were doing it to me!’” Matthew 25:31-40 NLT