You Spotify account was NOT hacked out of your iPhone. It was most likely compromised externally via a phishing email or something similar. If you have changed your Spotify account's password then you are good to go on that front.
As far your iPhone freezing and shutting down randomly, this is probably a separate issue than the one above. Please follow the instructions in this article by Apple and ➔ Force ReStart Your iPhone.
If that does not work then how is your Battery Health? Open Settings ➔ Battery ➔ Battery Health and let us know what is your Maximum Capacity percentage. If that percentage is at or less than 80% then your issues can be related to a failing battery.
Let us know what you find with details please.
Axel F.