I would say it's a fairly safe bet that you're going to have to replace your screen. The digitizer is obviously failing and since it's bonded to the OLED display, they can only be replaced as an assembly. Fortunately the XS model is old enough now that the price of parts has dropped significantly; the last soft OLED screen I got for my grandchildren's iPhone X was only about $35, but it looks like the XS screens are running about $10-15 more than that, but still cheap compared to when the phone was new.
The screen separation is a bit concerning, but it is possible the glue holding the display to the mounting frame has failed and would explain why it's coming apart. Normally we see that due to a swollen battery, but assuming you've opened the phone and physically checked then the frame glue is the only other thing that makes sense. Replacing the screen will resolve that problem as well.
[guide|113862|iPhone XS Screen Replacement - iFixit Repair Guide|new_window=true]