If the $x$ in $\int_{1}^{x}x^2dx$ is a constant, then the way in which people evaluate it doesn't make sense to me. For example, say $x=5$, then intuitively I would think of the integral as being the same as
$$ \int_{1}^{5}5^2=\left[25x\right]_{1}^{5}=25(5)-25(1)=25(4)=100 $$
However, this does not give the correct answer. Presumably, this is because we are looking at the area under of the graph of $y=x^2$, rather than the graph of $y=25$. However, if this is the case, then it seems $x$ is being treated as both a variable and a constant: a constant in the sense that it is one of the fixed bounds of integration; and a variable in the sense that we are looking at the $y-$values as $x$ changes. Putting these two together, it seems like $x$ is going from $1$ to $x$, which doesn't make sense to me.
It also seems that people try to get around this problem in a number of ways. The natural logarithm is defined as
$$ \ln(x)=\int_{1}^{x}\frac{1}{t}dt $$
If it is correct to write $\int_{1}^{x}x^2dx$, then why don't we defined the natural logarithm as
$$ \ln(x)=\int_{1}^{x}\frac{1}{x}dx $$
In the notation $$\int_1^x x^2\,dx,$$ the symbol $x$ represents one thing in some places and a different thing in another place.
The symbol $x$ is a so-called dummy variable within this expression:
$$ x^2 \, dx.$$
The notation $dx$ establishes $x$ as a dummy variable that is defined only within the integrand, which in this case is $x^2.$
On the other hand, the $x$ that appears at the top of the integral sign, $\int^x,$ is a free variable of this expression. You can do things to that variable that will have no effect on the dummy variable inside the integrand.
For example, if we add some text outside the integral,
$$ \int_1^x x^2\,dx \quad \text{where $x = 5$}, $$
the phrase "where $x = 5$" binds the formerly free variable $x$ to the constant value $5.$ So "$\int_1^x x^2\,dx \ \text{where $x = 5$}$" means
$$ \int_1^5 x^2\,dx. $$
The $x$ in $x^2$ isn't touched because, as before, the notation $dx$ declared that this $x$ is not the same thing as any $x$ that occurs outside the expression $x^2\,dx.$
Do you find this confusing? So do I! It is a terrible way to write an integral. The best policy is to choose a name for the dummy variable that is not used for anything else in the formula. For example, we could write $$ \int_1^x t^2\,dt, $$ which means exactly the same thing as $\int_1^x x^2\,dx$ but is much easier to understand and much less likely to cause mistakes.
Using $x$ for two different things in the same expression also leads to questions like this one: Integral notation confusion - $x$ vs. $t$.