Liquid has seeped into the screen to be particular the backlight of the display.
A screen replacement should fix the problem. If getting the screen replaced make sure to get the internals checked for any liquid that may have gotten inside the phone.
XR uses LCD instead of OLED which is why the discolouration looks different. With oleds liquid can't really get in between the screen.