Sorry for off the beaten path question. Struggling to know how integration can distinguish between a length and an area so I will frame the question in a peculiar manner.
I have a line $y = x.$ and $x = 5$. Is the arc length $5?$ From $0$ to $5?$ Is the area $25?$ Let's use integration. How can you tell the difference between arc length and area? If a straight line is not an arc length the question still holds: how do you keep the dimensions synchronized so one is a square giving area and the other a simple length ?

The easiest way to distinguish is to look at the integrals once you've assembled them, and do dimensional analysis. Here's the rule for dimensions using the two main calculus operations of differentiation and integration. A word about notation: $[x]$ means "the units of $x$". \begin{align*} \left[\frac{dy}{dx}\right]&=\frac{[y]}{[x]} \\ \left[\int y\,dx\right]&=[y]\,[x]. \end{align*} This ought to be taught in every single calculus course, but alas, it seems to be vastly neglected.
So let's take two examples: an arc length integral, and an area integral - the area integral first because it's more straight-forward.
Example 1: We want the area under the curve $y=x^2$ from $x=0$ to $x=2$. Let's say we're measuring both $x$ and $y$ in meters. No problem: $$A=\int_0^2y\,dx=\int_0^2x^2\,dx=\left(\frac{x^3}{3}\right)\bigg|_0^2=\frac83.$$ What are the units? Using the rule from above, $[A]=[y]\,[x]=\text{m}\cdot\text{m}=\text{m}^2$, so it's an area. Don't be confused because $y=x^2$. The units of $y$ are still just meters.
Example 2: We want the arc length of $y=x^2$ from $x=0$ to $x=2$ (hopefully this should look familiar). The formula is $$L=\int_0^2\sqrt{1+\left(\frac{dy}{dx}\right)^{\!\!2}}\,dx.$$ Let's check out the units according to our rules above: \begin{align*}[L]&=\left[\int\sqrt{1+\left(\frac{dy}{dx}\right)^{\!\!2}}\,dx\right]\\ &=\left[\sqrt{1+\left(\frac{dy}{dx}\right)^{\!\!2}}\,\right][x]\\ &=\sqrt{\frac{[y]^2}{[x]^2}}\,[x]\\ &=\frac{[y]}{[x]}\,[x]\\ &=[y]. \end{align*} Here, you'll notice we assumed that under the square root symbol, the units of the $1$ match $[y]^2/[x]^2$, or else we couldn't have done the addition. You can only add things together that have identical units. In any case, we wound up with units of length: $[y]=\text{m}$, so this result is a length, not an area.