designt a stable altitude for quadcopter

I'm currently working on a project to generate a stable altitude and automatic control for a quadcopter I'm using arduino as the flight controller Ultrasonic sensor HC-SR04 & MPU-6050 However my project expected outcome is to set the quadcopter to fly to 50 Cm above the ground(altitude hold). My problem is I don't know which one of the sensors (gyro or sonar) I have to use for PID set point can anyone help me with the code or the functions the I need to use ? im afraidif i use the ultra sonic sensor distance measurement as set point the mpu in this case will be useless so is it possible to use the ulrasonic sensor only (will no steer the quadcopter in the demo)