The answer
Some people may be granted the gifts of the Spirit like Judas and can perform miracles, but if they drift away, they will lose their eternal salvation. Gifts are not an indication of a strong personal relationship with God. Gifts are given to every believer. The fruit of the Spirit is an indication of a strong relationship with God.There are three passages in the Holy Scripture in which the Lord Jesus Christ says He does not, or He never knew these certain people (cf. Matthew 7:23, 25:12; Luke 13:27). In these passages, He is clearly speaking to the believers, not the unbelievers. These believers disappointed Him with their hypocrisy and lawlessness. They knew His teachings and expectations. They witnessed His miracles and may have performed some in His name. These are the ones that appeared to be outwardly religious and righteous, taught and prophesied in His name, but their hearts were far from Him. Thus, they never really knew Him. If they would have known Him, they would have been circumspect to walk through the narrow gate. If they knew Him, they would have exercised wisdom and been watchful like the wise virgins.
These are the hypocrites to whom He warned of the woes (cf. Luke 11:37-54) for their religious façade but lacked mercy. They rejected Him. Thus, He says, "Depart from Me, I never knew you." They rejected Him when they rejected the less privileged, the hungry, the thirsty, the naked, and the stranger. He revealed Himself in these who were perceived by the elite to be the least and He bore their rejection (cf. Matthew 25:41-46). Therefore, the Lord aligned Himself to these being the least, so that just as they were unknown to the privileged, these elite are rejected and unknown to Him.
Answered by His Eminence Metropolitan Youssef (opens in a new tab)