Sorting that out can be difficult! But I have learned that for me, it is important to focus on the relationship with God rather than on whether or not I am sinning. Naturally, I try to avoid sin, but more by growing in virtue for the love of God, out of a desire to please Him.
Now, that is the ideal, and I have by no means reached it!
As to your original question, praying badly is better than not praying, but improving in prayer is better.
When you are not feeling great about prayer, if you give in to that voice that says, you’re not going to do this well, or for the right reasons, so why not wait until you are more into praying?-- if you give in to that voice, who are you going to please: God or the devil?
(I heard that on the radio and it is very handy! I wish I could attribute it properly!)
About improving in prayer, what you need to so first is apparently to work on your distractions. Ask for God’s help first of all Then each time you notice you are distracted, just gently lead your mind back to where it is supposed to be. If you persevere, the distractions will diminish. They may come back time to time, but overall, they will reduce.
You may be ready for Catholic meditative prayer: https://www.google.com/url?q=http://catholicism.org/talk-mentalprayer.html&sa=U&ved=0ahUKEwiMifDJw6XdAhUD7awKHeMbCzgQFggLMAA&usg=AOvVaw3vfJ1VeUfCg1oVOQCjasBC