Is there a way to execute a php script outside WordPress?

A number of ways to do this.

You could use wp-cli, WP REST API or even include wp-load.php from a custom script and use built-in wp_delete_user() function.