It’s your lower back,hamstrings or both. Anyway,doing what you are doing will help with both. You can also try stretching one side invidually. Raise your leg on a deficit,both legs locked and straight,and carefully reach for your knee with your head. You can also do the ‘toe reach’ type stretch sitting down. Try to work up to grabbing both of your feet,then you can work up to getting your face to your locked knees from there (you don’t have to be close to this flexible for lifting but that will surely take care of your issues,just practicing this stretch). Right now it will probably seem physically impossible but determined stretching will cause reasonable flexibility gains in a reasonably short time.
Hold a stretch for at least one minute,two minutes if you can. Time is crucial. Dynamic stretching (bouncing and jerking about) is not particularly useful and may be completely useless for long term progress. You can employ it in your warm-up though. To get you closer to your present max range of motion more quicker.
My advice as a novice contortionist.