Hi @sharara ,
Try using the phone in safe mode and see if the problem still occurs.
If it doesn’t occur in safe mode (allow enough time to be sure) and it is operating on the battery only, then a downloaded app is the problem. The trick is to find out which one. You’ll need to uninstall each downloaded app, one by one, and run the phone in normal mode between each uninstall to see if it operates correctly. Once it does then the last downloaded app that was uninstalled is the cause.
If it still occurs in safe mode and if it only has problems when working on the battery only, then perhaps the battery is failing and needs to be replaced.
Here’s a link to the ifixit Moto Z Battery Replacement guide, which may be of some help.
Replacement batteries are available online. Just search for Moto Z battery to get results for suppliers of the part. Ensure that it is suitable for your exact model number.