Phone hangs problems depend on phone specification and your device's ram, storage space, and how to use it all influence the smooth processing of tasks.
Clear recent data cache memory, it will keep your ram a little bit free.
Uninstall heavy, games, and suspicious apps that you didn't use for a long time.
Don't use your phone continuously, sometimes it heats up a phone that can cause hang.
If your phone has less phone storage, it will increase your internal storage and help to run apps smoothly.
In an emergency case, just factory reset your phone before that take your file and personal and data backup.