Generally when we've seen this issue on an iPhone, it's been because the person forgot to take out the pentalobe screws first; otherwise the glue Apple uses seems to do a good job holding the parts together, so if you haven't removed them yet, that's the very next thing to do before going any further.
I agree with your diagnosis that it appears the LCD is coming off its frame. At this point you've got two options to continue; you can go ahead and proceed with taking the LCD off first, then go back around and remove the frame. If you do this the front sensors will stay on the phone rather than coming off with the screen like normal.
The second way to do it is to go back to the bottom of the phone and insert an opening tool between the screen frame and the phone frame and separate it, then continue on around getting the frame up. Once you've gone all the way around then you can hold the screen and frame together and take them off as one part.
Either way should work, although I would lean toward the second method in hopes it will be a little safer in terms of avoiding damage to the sensors. Whichever one you choose, you'll obviously have to purchase some glue to reglue the frame back onto the screen so you can reassemble it once you're done.
With care you should be able to get it apart without damage, so take your time and use a blow dryer or heat gun to soften the adhesive on the frame as you remove it.
@stephanandersen I haven't done a lot of work on newer iPhones, but on ones like the X when the frame separated it usually happened on aftermarket screens for me. That's not to say it can't happen on an original screen, just that when we see it, it's usually from not removing the screws, but as you've found, not always.
As described in my original answer, you'll want to go ahead and disconnect the LCD to get that out of the way, then get the screen frame separated from the phone's midframe. If you use something very thin you may be able to pry it up from the outside, but you could also go in from the inside with, for instance a thin flat blade screwdriver and twist it carefully to get the adhesive separation started. Once you've got a gap, go around with the opening picks just like you would with the screen still in place.
The sensors will come off and at that point you can unplug them. If you're planning on reusing the screen you'll obviously have to glue the frame back on, so you'll want to be careful when removing it to keep from bending or warping it as much as possible so it'll go back on securely.