I'm not a doctor but did study anatomy for yoga teacher training -
Do you sit a lot? if so it sounds like maybe the psoas or hip flexor which wraps from the back around to hip may be tight or irritated. If the hip is out of whack that might take the knee with it.
Have you tried gentle stretches to see if it helps?
There's great beginner youtuber called Yoga with Adrienne who has a bunch of these kinds of stretches. When i say gentle stretches, please be kind to yourself and be super gentle ๐
There's a big difference between pain and discomfort. If you feel any sharp pain, needless, numbness stop the stretching immediately. If it's just achy just stay there for a bit and see if it loosens up.
Finally as someone who had had back issues - i was told if you ever experience any sudden weakness, numbness or have trouble urinating get to the ER asap. That might be a nerve problem which is serious and needs attention.
Please let us posted on how you get on if you're comfortable sharing. Sending all good thoughts through the electrons for a speedy recovery โค๏ธ