Why do i only sound bad sometimes when I sing?

So two questions:
1 (and the main one) when i sing with a song playing in the background i sound way better than when i try to sing with nothing playing. So what's up with that (i know most likely psychological)?
2. How can i make my voice just, well, sound better. When i sing with the music it doesn't sound too bad and when i record it with my iphone it doesn't as good but alright but the thing is no matter what my voice just sounds like it's sorta missing something and i don't know how to fix it. Oh and i'm poor so NO VOCAL COACHES, i don't wanna waste my parent's or the little money i have on that.

When you say song playing in the background do you mean the backing track or do you sing along with the actual artist?
If you sound good singing with the artist it's probably because their voice takes a lot of the focus off yours and maybe you can keep in tune better following them?

To sound better I'd suggest warming up if you don't already. There's loads of YouTube videos with coaches demonstrating some vocal warm ups if you can't afford a coach, and it really does help. I never sing now without warming my voice up. Also make sure the song is right for you, if it's too high or low for you it won't sound as good as a song that is in your range! And then just practise, keep recording yourself and eventually you will improve!

What is likely to be happening is that when you sing along to music you aren't listening to what you are singing you are listening to the music. Being able to concentrate on listening to your voice and other music equally well comes with a lot of musical ear training.

To sing well you have to have singing lessons, because people only sing well if they have learned the correct singing techniques. You can't learn the correct singing techniques from videos on youtube or anywhere else. The reason why you can't use these videos is because they are often posted by people who think that they can sing but actually know nothing about singing, or because you don't know anything about correct singing techniques you could misunderstand what they are saying.

If you can't afford singing lessons now then the next best thing you can do is to join a choir. Then when you have finished your education and are working you can pay for your own singing lessons.