What could be the reason for soreness in the area behind the right ear and a headache like feeling in that area at times?

One possibility is TMJ or teeth grinding. It usually occurs at night so you might not be aware that you are doing it. It is a way that our body releases too much stress and worries. You could inspect your teeth for signs of clenching or grinding. Or try to catch yourself doing it. Does your jaw pop? Your dentist could help you if this was the case.