First, make sure nothing (external drives, docks, hubs, printers ...) is connected to your Mac. Try again. Does the problem still occur?
If it does ...
Make sure you have a reliable backup (I usually make two backups).
DIagnostics:
Boot into Safe Mode
Start up your Mac in safe mode - Apple Support
After booting into Safe Mode, shut down to see if it is fixed. If it works in Safe Mode, you have something installed that is conflicting. One way to track this down is to download and run Etrecheck and post the output using the Additional Text button below. You can check before posting -- no identifying information is included in the output. Etrecheck reveals all the additional extensions installed. Examples of things that can cause trouble include: anti-virus, security suites, "cleaning" apps, third party disk utilities, and the like. Do you have any of those installed.
If you still cannot shut down in Safe Mode, reset the SMC if your Mac supports it:
How to reset the SMC of your Mac - Apple Support
If this does not fix it, reset NVRAM (if your Mac supports it):
Mac startup key combinations - Apple Support
Then shut down to see if it cured the problem.
If not, boot into Recovery.
Mac startup key combinations - Apple Support
Run Disk Utility from there to perform First Aid and repair the disk's file system. (You may have already done this.)
Restart, see if the problem is gone. If not, reinstall the MacOS from Recovery. Do not choose an option to format or erase the disk, choose the option reinstall the MacOS. This will not affect your files.
How to reinstall macOS - Apple Support
If none of the above works, the Etrecheck output may reveal the cause of the problem.