resize only height using wp_get_image_editor

You can get the original sizes of the image being uploaded:

list( $uploaded_width, $uploaded_height ) = getimagesize( $_FILES['u_img']['tmp_name'] );

Then you can use those values to size the image as you like:

$height = 300;
$image = wp_get_image_editor( $_FILES['u_img']['tmp_name'] );
$image->resize( $uploaded_width, $height, true );