Software, peripherals, and other invisible errors on your Mac could cause the Mac won't shut down. Disk error is one of the possible reasons. If you fail to repair the disk in Disk Utility, you can try the Terminal commands. A corrupted Mac disk may also lead to the Time Machine stuck on preparing backup error.
According to your description, the Mac hard drive may be corrupted so that the Mac won't shut down and the Time Machine stuck on preparing backup. Disk Utility's First Aid is designed to check and repair disk errors, however, it fails sometimes. When Disk Utility can't repair disk error, here is what you can try:
Run First Aid to repair the APFS system volume again in macOS Recovery Mode.
Try Mac Single User Mode to run the command /sbin/fsck -fy.
Reformat the APFS system volume to fix disk errors. This will delete all contents, you can try data recovery software such as iBoysoft Data Recovery for Mac to recover and get the data off the drive before reformatting.