iOS 12 and later comes with a Measure app that allows you to draw (virtual) straight lines to measure objects and surfaces both vertically and horizontally using your iPhone or iPad camera, and automatically detect dimensions of rectangular objects. Here’s how to use it:
After opening the app, move the white dot to your starting point and tap the “+” button.
Move the white dot to your endpoint and tap the “+” button to mark it.
You can now see the final measurement located in the middle of the line that appears.