· For up to 10 seconds, press and hold the power button on your Mac until it goes off. After that, restart your Mac.
· If the problem persists, turn off your Mac by pressing and holding the power button. Then unplug all of your Mac's peripherals, including as printers, hard discs, USB hubs, and other non-essential equipment. One or more of those devices, or their cords, could be malfunctioning. After that, restart your Mac.
· If the problem persists, hit and hold the power button until your Mac shuts down completely. Then repair your starting disc with Disk Utility.
· Reinstall macOS if Disk Utility discovered no issues.
· Restart your Mac if Disk Utility discovered and repaired issues. Reinstall macOS if the problem persists after resuming.
· If you want further assistance, please contact Apple Support.
https://www.mygeekshelp.com/macbook-stuck-on-apple-logo-screen/