Back and Hip Pain

I’m only 17 but I figured I’d post this here because I think the older lifters will be able to help with this question better. I’ve been having back pain for like 2 years. Within the last 5 or 6 months my hips have started cracking and snapping a lot and they hurt. When I rotate my right hip outwards and then back in it snaps. Also when I wake up in the morning I always have to kind of push my knee inwards and make my hip kind of snap into place (thats what it feels like, not sure if thats actually happening) to adjust both my hips; I have to do this periodically throughout the day besides in the morning. If anyone has any idea what this problem is and how to fix it please let me know. Also, if you don’t know how to fix the problem please tell me what type of doctor I should go to to get help for this problem. Thanks