I have two 2.4 inch XPT2046 displays.
The XPT2046 is wired differently on each screen.
Note that any Touch Panel is glued and hard-wired in one position.
e.g. X, Y might be wired for PORTRAIT on one display and LANDSCAPE on another.
If your Application is in LANDSCAPE but your XPT2046 was wired for Portrait, you need to swap X, Y.
Likewise, you probably want to calibrate your panel so the library gives you screen pixel coordinates.
Some libraries return raw XPT2046 values.
Some libraries return pixel coordinates.
You are using XPT2046_TouchScreen.h library. It looks as if you always get the raw values.
You can use the Arduino map() function to transform the raw value to a pixel coordinate.
You can use a Calibration sketch to get the TS_LEFT, TS_RT, TS_TOP, TS_BOT values for your panel.
But you can get a rough guess by just assuming TS_LEFT is about 100 and TS_RT is about 3900.
David.