True and False Disciples.
v.21 Jesus says it is the person who does the will of God that will go to heaven (see also Rom 2:13). An oral confession (Lord, Lord) without a repentant heart will not be enough (but see Rom 10:9-10) to enter the kingdom.
v.22-23 Jesus decides who will enter the kingdom on ‘that day‘ and who will be banned from his presence. The criteria is your relationship with him, i.e. whether he “knew you“. Having done works will not save you in the end if you do not know Jesus.