Contact Sony for help and repairs https://www.sony.co.uk/electronics/support/mobile-phones-tablets-mobile-phones
does your charger click in when you put it on charge or is it loose?
often see in o2 stores, majority of customers who have a charging issue can resolve it by simply cleaning out the charging port, sometimes pocket fluff / lint can gather in the port and everytime you charge the phone, it compresses the lint right in to the back of the port
shine a light in to the port and see if you can scrape anything out with a fine pin / needle while obviously taking care not to damage the charging port
the xz 2 is also wireless charging i believe so you could try a wireless charger and see if that makes any difference , any QI enabled wireless charger will do the job
Track usage, upgrade and get support with the My O2 appDownload My O2