Do you have other devices - docks, hubs, drives, etc - plugged into the computer at restart?
If so, then disconnect them and see what happens.
Have you installed any anti-virus, cleaning or optimizing apps or VPN software?
If so, then disable - better yet, uninstall those unneeded apps - and see if that has any effect.
I see you've chosen 10.13 as your OS. The last version of that obsolete OS is 10.13.6.
Is your OS up to date? If not, then apply any available updates.
If a simple reboot of your Mac doesn’t fix things, see if the problem still happens in safe mode. Use a wired USB keyboard for this. If you have the Magic Keyboard, plug that into the Mac with its charging cable.
How to use safe mode on your Mac - Apple Support
Safe mode will often correct weird software behavior by forcing the OS to clear caches, do disk repair and other self-maintenance and housekeeping and temporarily disables third-party mods.
Exit safe mode by restarting your Mac normally, then reevaluate the problem.