If your voice hurts while singing, it's usually a sign of vocal strain. Often, this is due to poor technique that doesn't allow your voice to relax and let the notes come in freely.
There are a number of causes for this, including:
Food and drink (including dairy products) can cause mucous buildup in the throat that can clog it up and exacerbate this problem. You should try to avoid these foods and drinks as much as possible, especially if you're trying to increase your singing range.
Dehydration can also make your throat feel dry and sore. You can prevent this by drinking plenty of water and making sure you're getting enough sleep every night.
Often, singing beyond your vocal range will put stress on the muscles that vibrate and stretch your vocal cords, and this can lead to microscopic tears in the vocal folds. This can be uncomfortable and cause you to stop singing for a while until you are able to recover from the strain.
Other reasons that your throat might hurt while singing include:
Your vocal folds are covered in a mucus membrane that helps them protect them from injury, and when you sing on a sore throat, the mucous in your throat can irritate them. This is a common cause for singers to get a sore throat and it's generally a good idea to avoid singing on a sore throat.