hip flexors originate at the lumbar spine/pelvis(think abdomen area) and attach at the top of the femur(thigh)– therefore, they function  to flex the hip—bring the thigh closer to the upper body but also in real life, i.e., functionally, the hip flexors help keep the spine balanced over the lower body when walking/running.  Strengthening the hip flexors by performing leg lifts is fine; but along with much sitting in our daily life the hip flexors  become conditionally shortened.  In addition to and in some cases instead of only strengthening,  they need to be exercised in a lengthening-type way.

therefore, an appropriate exercise is REVERSE LUNGES or walking/stepping backwards.  perform 3 sets of reverse lunges,  8-10 reps on each leg.  check that front knee to make sure it is behind the toes of same leg(a trainer can spot that for you, but so can a mirror)