Christ bore the sin and punishment of His people [He foreknew] to redeem them from the hands of justice and the curse of the Law. He, however, was not indebted to redeem those for who He was not a Surety.
Those Jesus will say these words to Matt 7:
22Many will say to me in that day, Lord, Lord, have we not prophesied in thy name? and in thy name have cast out devils? and in thy name done many wonderful works?
23And then will I profess unto them, I never knew you: depart from me, ye that work iniquity.
Jesus Christ never bore the sins of those He says, I never knew you.
For He knows those who are His per 2 tim 2:19
Nevertheless the foundation of God standeth sure, having this seal, The Lord knoweth them that are his. And, let every one that nameth the name of Christ depart from iniquity.
Jn 10:14
I am the good shepherd, and know my sheep, and am known of mine.
And He layed down His Life for His Sheep vs 15
As the Father knoweth me, even so know I the Father: and I lay down my life for the sheep [or those I know]
Consequently, its very reasonable to conclude, that Jesus did not lay down His Life for those in Matt 7 :23, to whom He said I never knew you !