Most passport and ID applications want a specific pixel size and a face that fills a specific share of the frame. Cropping to their numbers is straightforward once you know them.
A United States passport photo is square. A United Kingdom one is not. Head height, background colour and acceptable file size all vary by country and sometimes by document type within a country. Anyone who tells you there is one correct passport photo size is wrong, so start by reading the actual requirements for your application.
The failures are nearly always physical rather than technical. Shadow on the background, hair across an eye, a smile when a neutral expression was required, glasses catching a reflection. No amount of cropping fixes those, so it is worth retaking the photo rather than trying to rescue a bad one.
Get the crop right before resizing. Cropping first and then scaling to their pixel size keeps the framing you chose. Doing it the other way round leaves you cropping a small image and losing detail.
No tool can promise that. Acceptance depends on the photo itself, the pose, the background and your own country's rules. This gets the dimensions right, which is only one of those things.
You can cut out the background with the erase tool and place the subject on a plain colour, but many authorities do not accept edited backgrounds. Check first.
No. It never leaves your device, which matters more than usual for a photograph of your face attached to an ID application.