Turn off application passwords, which let apps access your site through the REST API, if nothing on your site uses them.
add_filter( 'wp_is_application_passwords_available', '__return_false' );
Always add PHP to a staging site first, or have FTP or file manager access ready, so you can undo it if something goes wrong.
Application passwords let external apps, scripts and services sign in to the REST API on a user’s behalf without their main password. If nothing on your site uses them, they’re one more way in for an attacker who gets into an account.
Returning false from wp_is_application_passwords_available removes the Application Passwords section from every user profile and makes WordPress reject them for authentication. Existing application passwords stop working straight away.
wp_is_application_passwords_available_for_user filter and return user_can( $user, 'manage_options' ).Open Users → Profile. The Application Passwords section should be gone.