There are some step to reset your phone in safe mode
press the power key and hold for like 20 sec .
now tap the power off option .
just press the power key and hold if for more than 1 min
keep holding it . it may ask you to confirm the safe mode
please confirm it and wait for 1 min .
And second method is -
To Boot android phone in safe mode you can also try Volume Up + Volume Down + Power without doing reboot on your phone .
this may take you to recovery options also be care full here you don’t want to end up resetting your phone and losing you settings and data.
Note- But I think Your phone is just a hanging problem because of some virus so after reset update new antivirus.