How to hide unused profile fields?

You have the JS part down, in order to have this script run, you can use the add_action function and hook it to the admin_head. This will run your custom JS script in the header of the wp-admin area. Below is the code that you can add to your child theme’s function.php file.

I’ve added a rule to only implement this JS function to the related profile pages such as profile.php, user-edit.php, and user-new.php so you won’t see it there. Also, I prefer to use hide() instead of remove() because if you were to remove a required field (ex: Nickname) instead of hiding it, you will have trouble saving your profile. See this link for the differences.

function wpse_238281_hide_profile_fields() { // Hide unused fields from user profile
    global $pagenow;
    $page = array(
        'profile.php',
        'user-edit.php',
        'user-new.php'
        );
    if ( in_array( $pagenow, $page, true ) ) {
        ?>
        <script type="text/javascript">
            jQuery(document).ready(function($) {
                $('input#url').closest('tr').hide();
                $('input#description').closest('tr').hide();
            } );
        </script>
        <?php
    }
}