How can I restrict image upload dimensions for non-admin WordPress users?

I’ve modified this answer from brasofilo. Modify the width and height values in the following line in the below code to your needs…

    $maximum = array( 'width' => 500, 'height' => 700 );

… and then add the code to your theme’s functions.php file.

add_action( 'admin_init', 'wpse_371740_block_authors_from_uploading_large_images' );

function wpse_371740_block_authors_from_uploading_large_images()
{
    if( !current_user_can( 'administrator') )
        add_filter( 'wp_handle_upload_prefilter', 'wpse_371740_block_large_images_upload' ); 
}

function wpse_371740_block_large_images_upload( $file )
{
    // Mime type with dimensions, check to exit earlier
    $mimes = array( 'image/jpeg', 'image/png', 'image/gif' );

    if( !in_array( $file['type'], $mimes ) )
        return $file;

    $img = getimagesize( $file['tmp_name'] );
    $maximum = array( 'width' => 500, 'height' => 700 );

    if ( $img[0] > $maximum['width'] )
        $file['error'] = 
            'Image too large. Maximum width is ' 
            . $maximum['width'] 
            . 'px. Uploaded image width is ' 
            . $img[0] . 'px';

    elseif ( $img[1] > $maximum['height'] )
        $file['error'] = 
            'Image too large. Maximum height is ' 
            . $maximum['height'] 
            . 'px. Uploaded image height is ' 
            . $img[1] . 'px';

    return $file;
}