Jesus said, in effect, that some people were going to get the shock of their lives when they stood before Him on the final day. They had taken for granted that they would be welcomed into heaven with great fanfare because they had prophesied, cast out demons and done many miracles in Jesus' name (Mt.7:22)! They thought that Jesus would not only be very thankful to them for what they had done but also excited to use them as examples before other people in heaven! But they were shocked to the core when He publicly disowned them, saying that He never knew them (v.23).
How could they have done such supernatural things without power from God? How could Jesus have given them power if He was not pleased with them? One explanation could be that their power came from deceiving spirits pretending to be coming from God (2Co.11:13,14). Did you know that a lot of miracles are being performed these days in the power of Satan and not God (Mt.24:24)? We can see that if we look carefully at the fruit (Mt.7:15,16). Another explanation could be that God used these people just as He used heathen people like Nebuchadnezzar to accomplish His will, but such people never had any relationship with Him. It is obvious that they didn't have such a relationship because their claim to the kingdom was their good works and not faith. Such people cannot be accepted by God (Ro.9:32).
Many foolishly assume God is pleased with them because they were born in a Christian family, they have done many things for God or His people, they have not been as bad as some others, etc. What would be our shock if we have such assumptions but we are not acceptable to God?
God has not made the condition of acceptance too high for any of us. We are not asked to live up to a certain standard or accomplish certain things for Him. There is also forgiveness for our past, however bad. What He requires from us is to be honest about our innate sinful nature, admit and confess our actual sins and to go to Him asking for forgiveness and acceptance because He is a gracious God. We go to Him in this faith because He has demonstrated His willingness to accept us by putting His Son, Jesus, to death for our sins (Ro.5:8). It is this faith that comes along with sincere repentance that guarantees His acceptance. This is open to everyone who wants (Re.21:6).
With this kind of open invitation from God, none of us needs to make any false assumptions or to live in uncertainty. When God accepts us we can know in our heart that He has made us His children (Ro.8:15). We will experience the work of the Holy Spirit in our lives glorifying Jesus and changing us into His image (v.16). We will receive an assurance of eternal life (1Jn.5:11,12). When we stand before God we shall not boast about what all we have done for Him or how great we are, but we will rejoice to confess that it was the rich grace of our God and our Saviour that took us out from a life of sin and made us children of God.