Matthew 7:21-23 is referring specifically to his Jewish followers (and subsequently Christian believers) who think they are doing what God wants but really are not.
How would God treat the unbeliever, I cannot say, other than to speculate it would be a matter of how that person had treated other people in the sum total of their life.