Why other apple ID-s appearing constantly? I hard restarted, restored and updated my Iphone X 'casue it constanty kept turning off in the most random moments. When I started to setup and backup I saw other 5 apple ID-s popping up (I've never seen them before, and they're not mine), Iphone said that there were some purchases made with these ID-s and it wanted me to type in the passwords. Is it possible that I have some malware/spyware on my phone or it was hacked?

Thanks for any helpful answers in advance.
It sounds like you are restoring the phone from a backup (iCloud or otherwise) and such a backup is placing all of your old apps back on your phone, which it is supposed to do.

It sounds like what is happening that some of the apps were downloaded under another AppleID. Whether it is someone who was using your phone and did this or the apps are from other sources.

The only way to get around this (without jailbreaking your phone) is to cancel all app installs and then download them one at a time from the app store under your personal AppleID. Apps that are associated with your current AppleID will have the download icon next to them (cloud with a downward pointing arrow) all others will have have a "GET" or "BUY" button.