ever since the knee replacement I have felt like my operated leg is longer than my other leg.
This is quite common in knee replacement surgery. My operated leg is also marginally longer, because the surgeon needed to straighten my leg (which was badly bowed) during the replacement.
Interestingly though, the hip and back pain you describe may not be from the differential in leg length. I had a similar complaint during my first few months post-op and it turned it that the pain was my body getting used to being in proper alignment after so many years of being slightly twisted because I was favoring the bad knee.
In my case, the back and hip pain have completely disappeared. In fact, I spent my summer vacation hiking along fjords and up-and-down dirt paths without any difficulty.
You will be able to hike again! Just give your body time to adjust to its new posture.