Firstly, you should pick a bag that’s the right size for you to comfortably carry, i.e. small, medium, large etc. Arguably the most important measurement for a backpack to fit properly is basing the size on your torso length rather than height.
To measure your torso, tilt your head forward and feel for the bony bump where the slope of your shoulders meets your neck. Place the measuring tape at the base of your neck and run it down your spine. Stop at the point where your spine meets your hips. If you’re unsure of your exact measurement, err on the side of caution and choose a size that is slightly larger than your actual measurement.