There are two paradigms when it comes to the treatment of units (note that this is a generalisation as some mathematicians use the physicist's paradigm, and vice versa):
1. Mathematician's paradigm
Variables ($x$, $t$, etc.) are the numerical value of quantities when expressed in a chosen set of units.
- $x$ is the number of metres, $t$ is the number of seconds, etc.
- $x = 1$ represents the physical length of 1 metre, $t = 1$ represents the physical length of 1 second, etc.
In this paradigm, there are no units in any of the symbols $x$, $y$, $f$, etc.
So when you write $y = x^2$, both sides of the equation don't have units. The variables $x$ and $y$ are numbers that represent a length, and so the result of the integral is a number that represents an area.
2. Physicist's paradigm
Variables ($x$, $t$, etc.) are actual physical quantities, and therefore contain units within them.
- $x$ is the number of metres multiplied by a physical metre; $t$ is the number of seconds multiplied by a physical second, etc.
- $x = 1 \,\mathrm{m}$ is a physical length, $t = 1 \,\mathrm{s}$ is a physical time, etc.
This paradigm is unit-independent; e.g. $x = 1 \,\mathrm{m}$ and $x = 100 \,\mathrm{cm}$ mean the same thing.
Under this paradigm, if $y$ is supposed to be the height of the curve, then you cannot write $y = x^2$, because area is not length. Instead, you must write
$$
\frac{y}{\mathrm{m}} = \left( \frac{x}{\mathrm{m}} \right)^2
$$
or
$$
y = \frac{x^2}{\mathrm{m}}
$$
so that the dimensions are consistent.
Likewise:
On the other hand, if you aren't thinking about the integral as being an actual area, then you can have things like
- $s = \int v \,\mathrm{d}t$ (displacement = velocity × time)
- $W = \int F \,\mathrm{d}s$ (work = force × displacement)
so long as the dimensions of the equation are consistent (integral = integrand × independent variable).