While the Compass app can be helpful with pointing you in the right direction, there’s also a hidden inclinometer. To reveal it, swipe across the screen from right to left.
While holding the phone vertically or horizontally a spirit level appears and you can use the straight edge of the device to check if something is level. If you place the iPhone flat on it’s back, two bubbles appear and you can check if that surface is flat too.
Tap the screen at any point to set that as 0° and tap again to reset to default.