How Can I Edit a WordPress Site’s PHP Files Without Breaking the WP Install?

You just don’t do such things as any changes you will do will be lost on an upgrade.

If you need to make changes to WordPress core files (very unlikely) you should use git for version control, and properly test everything before uploading to the server, then you should disable automatic updates, and with every new version you need to merge your changes to the latest core “trunk”.

Tl;Dr

Just don’t do it.