Welcome to Android Central forums. I think we will need a bit more information to begin offering you advice.
In your title when you say, XZ3 cannot detect USB, do you mean the phone doesn't recognize the USB connection or do you mean the PC/laptop doesn't recognize the phone?
You say you're trying to transfer a file, which way are you trying to transfer it, from or to the phone?
Changing the cable is a good first step if one device or the other is not recognizing the other but could you describe the method you are attempting to use to perform this transfer? Please go into detail, for example, I plug in the USB to both devices, then open Windows Explorer, find the device in the sidebar...
Do you see either device in the storage list of the other device? So if you open Windows Explorer, go to My Computer, do you see the phone listed there or when you go to an app like My Files on your phone do you see the PC listed as a storage device?
Is this a new problem that just started or have you never been able to transfer files?
Are you unlocking the phone? Are you selecting, Transfer Files, from the phone's list of USB actions? Typically if a device doesn't show up on a PC/laptop in Windows File Explorer or if it does but the folder is empty when attempting to open it, the issue is because the device is locked or the USB option is wrong. With the USB connected to both devices unlock the phone>swipe down the notification shade>scroll to the bottom (usually) and find the USB symbol>touch this and tell us what option is selected for what the phone should do when connected to the USB. Does unlocking or changing this option allow you to do the thing you wanted to?
IDK, let us know what you find and provide more details and we will offer more advice.