There can be multiple things which may cause this issue:-
1. Check if there isn't any third party app which might have caused the device to slow down.
2. RAM management - there should always be adequate RAM available if the device needs to work flawlessly.
4. Restart whenever you face this issue.
5. Restart the device in safe mode – i- Power button hold for 2 seconds.
ii-tap on the power off message which pops up on the screen, hold for few seconds it will give you an option to boot in safe mode and check how it works.
iii- Restart your device to exit safe mode.
7. If nothing work you can back up your phone & factory reset your device.
Thanks!