Many Christians doubt their salvation for many reasons. Some doubt because of some sin they have been struggling for a while, which may also even be years. Some doubt because they compared their Christian life to someone else's walk with the Lord. Some doubt because of some bad teaching they have believed in all their life.
I heard one woman prayed that she will do the best she can to "keep Jesus in their heart." That is tragic. This woman think Jesus will leave her if she disobeys or not follow him wholeheartedly. The Bible teaches that nothing can separate us from his love nor his salvation:
My sheep hear my voice, and I know them, and they follow me. I give them eternal life, and they will never perish, and no one will snatch them out of my hand. My Father, who has given them to me, is greater than all, and no one is able to snatch them out of the Father's hand. I and the Father are one (John 10:27-30)
For I am sure that neither death nor life, nor angels nor rulers, nor things present nor things to come, nor powers, nor height nor depth, nor anything else in all creation, will be able to separate us from the love of God in Christ Jesus our Lord (Romans 8:38-39)
Notice the words that are in bold. In John 10:29, Jesus said no one can snatch us from the Father's hand, and in Romans 8:39, Paul said anything in creation can separate us from God's love. This also includes yourself. Tim Keller said, "If grace is cannot be earned, what makes you think you can unearn it?"
When doubts of salvation come, we have a tendency to look at ourselves rather than trusting in Jesus. Jesus secured your salvation because of his perfect life and sacrificial death on the cross yet we say its not enough because I depend on myself. Many Christians believe that you can forfeit your salvation. The truth is you cannot. I know all of us struggle with sin, but our struggle with sin, as Darrin Patrick puts it, is not a sign of God's absence, but a sign of his presence.
The book of 1 John is the book of assurance in the Bible. I strongly encourage to read and study it. Also make sure you read Romans 7, if there is a sin your are struggling with right now. I echo what John MacArthur said, if we did not have Romans 7 and only have 1 John in the Bible, we would all doubt our salvation. I pray you rest on the grace of God and the finished work of Jesus to know you are saved.
2 Ways To Know Are Saved by J.D. Greear
Also, Hebrews 6 is the most quoted text by those who teach salvation can be lost. Dave Jenkins dives into this difficult text as he writes on Assurance and Perseverance