For those who do not want to see a theological argument, don't read this comment or its chain. Take my quote as comfort or ignore it as you like.
For those interested in theological discussion:
The Parable of the Sheep and the Goats is quite clear and one of the few times Jesus talks about the afterlife and the nature of judgement in any detail. It goes as follows: (NIV translation)
“When the Son of Man comes in his glory, and all the angels with him, he will sit on his glorious throne. 32 All the nations will be gathered before him, and he will separate the people one from another as a shepherd separates the sheep from the goats. 33 He will put the sheep on his right and the goats on his left.
34 “Then the King will say to those on his right, ‘Come, you who are blessed by my Father; take your inheritance, the kingdom prepared for you since the creation of the world. 35 For I was hungry and you gave me something to eat, I was thirsty and you gave me something to drink, I was a stranger and you invited me in, 36 I needed clothes and you clothed me, I was sick and you looked after me, I was in prison and you came to visit me.’
37 “Then the righteous will answer him, ‘Lord, when did we see you hungry and feed you, or thirsty and give you something to drink? 38 When did we see you a stranger and invite you in, or needing clothes and clothe you? 39 When did we see you sick or in prison and go to visit you?’
40 “The King will reply, ‘Truly I tell you, whatever you did for one of the least of these brothers and sisters of mine, you did for me.’
41 “Then he will say to those on his left, ‘Depart from me, you who are cursed, into the eternal fire prepared for the devil and his angels. 42 For I was hungry and you gave me nothing to eat, I was thirsty and you gave me nothing to drink, 43 I was a stranger and you did not invite me in, I needed clothes and you did not clothe me, I was sick and in prison and you did not look after me.’
44 “They also will answer, ‘Lord, when did we see you hungry or thirsty or a stranger or needing clothes or sick or in prison, and did not help you?’
45 “He will reply, ‘Truly I tell you, whatever you did not do for one of the least of these, you did not do for me.’
46 “Then they will go away to eternal punishment, but the righteous to eternal life.”
It does not require that the Sheep or the Goats are believers. It judges them according to their sins and virtues. Who fed the hungry, clothed the naked and housed the homeless? That's what matters to God.
It ties into Jesus' remarks about how to enter heaven one must become like a child, and also like a bird. That is to say, curious, innocent, caring, and trusting. The key factor being that attitude and action is the entrance into heaven.
But, this is an argument with many facets, and people smarter than both you and I have laboured for two thousand years to fully understand Jesus' message. Some come down on my side, others on the side that believes you must be baptised and 'saved' in order to enter heaven.
And when it comes down to it: If God does not let in the people who clothed the naked, fed the hungry and sheltered the homeless because they were unbelieves, but does let in the believers who ignored the naked, ignored the hungry, and ignored the homeless then he is not God. He is simply the petty dictator of the universe, and unworthy of belief.