Jesus said that if you love Him you will keep His commandments (John 14:23). God says in His Word through the Apostle John that if you keep Jesus' commandments then you will be perfected in His love (1 John 2:5). He said that if you are perfected in His love then you will have confidence before Him on the day of judgment (1 John 4:17). If you don't have confidence but have fear it is because you have not been perfected in God's love which means you didn't keep His commandments (1 John 4:18). The unknown writer of Hebrews says that Jesus Christ is the author of eternal salvation to all who obey him (Heb 5:9).
Once a person becomes born-again through the regeneration of the Holy Ghost and evidences this new birth by a changed life, he is expected to walk in obedience to Jesus (make Jesus Lord) and is to live godly in Christ Jesus. Every truly born-again person starts out on this path but reality has it that some get away from God. They may have been hurt by someone and chose not to forgive. They may have gotten their eyes off of God and had an adulterous affair like King David did or like the man at the Church of Corinth who had relations with his father's wife. They may have gotten involved with the occult (played with the Ouija board or went to a fortune teller for fun). Maybe they just got rebellious towards God about something God wanted them to do. Whatever they have done they begin to walk in the flesh, they come under condemnation for their sins (Romans 8:1), and over time they end up losing interest in the things of God and they live like the world. I have witnessed this in different degrees in several believers.
Jesus place the retention of our salvation into the hands of God. God will make every effort to bring a wayward Christian back into a right relationship with Him. The believer can either choose to obey or choose to disobey. If the believer chooses to disobey and he dies in his sin then he will perish because God is not a respecter of persons. If he chooses to obey then he will live.
Testimony of Gladys, a born-again Christian, who feared dying.
When I met Gladys in the nursing home she was a very difficult person to deal with. She cussed and was very ugly towards everyone. When I told her she needed Jesus she would say that she already had Jesus. I told her that she needed to act like it then.
I was going nowhere with Gladys in this issue. God told me to fast and pray for her salvation. I did. Then some time later when I was visiting her in her room God told me to deal with her in her need to recommit her life to Jesus. I told her that she needed to recommit her life to Jesus and that she heard. When I gave her the gospel the Holy Ghost was all over that lady in a very strong way convicting her that she was a sinner and that Jesus died for her. She wanted to recommit her life to Jesus and she did.
That lady changed. She no longer cussed and was no longer a difficult person to get along with. Plus, there were other changes in her life.
A short time later, maybe 3 weeks or so, when I walked into her room, she said that she was afraid to die. I was sort of taken aback by this. I told God that I didn't understand. She just got saved not too long ago and this shouldn't be. God told me to ask her about her past.
As Gladys recounted her life I found out that she had been wounded real bad by her husband and other people. She was holding unforgiveness in her heart towards those people. I told her that she needed to forgive them or God would not forgive her. She began to forgive each person as she recounted her experiences with them. When she was done with what God was dealing with her about she said, 'I am not afraid to die anymore.'
Gladys was truly born-again. She showed it by a changed life. But there was an unforgiveness issue that God needed to deal with. When God dealt with it, she responded and forgave. She then was no longer afraid to die.
The only way for a believer to have peace on his death bed is to be right with God (1 John 4:17). If he has fear, then he is not right with God (1 John 4:18). If a believer is not right with God it is because there is some sin in his life that God needs for him to repent from. For Gladys it was unforgiveness. For others it might be adultery. For others, it might be a judgmental spirit. For others, it may be that they never put God first in their life. What ever the case may be, God knows what it is and He will deal with a believer about the sin issue and give him a chance to repent. If he obeys God, he is cleansed from his unrighteousness and will go to heaven when he dies. If he rebels and refuses to obey, then God cannot cleanse him from that unrighteousness. The believer will perish because he died with unforgiven sin.