The expectation value of the momentum of a one-dimensional wave function $\Psi$ is
$$\langle p \rangle = \int_{-\infty}^{\infty} \Psi^* \hat{p}\Psi \, dx = \int_{-\infty}^{\infty} \Psi^* \left(-i \hbar \frac{\partial}{\partial x}\right)\Psi \, dx.$$
The square of the uncertainty of the momentum is
$$\sigma_p^2 = \langle p^2 \rangle - \langle p \rangle ^2.$$
From the reading I have done, it seems that $\langle p^2 \rangle$ is calculated as
$$\langle p^2 \rangle = \int_{-\infty}^{\infty} \Psi^* \hat{p}^2 \Psi \, dx = \int_{-\infty}^{\infty} \Psi^* \left(-\hbar^2 \frac{\partial^2}{\partial x^2}\right) \Psi \, dx.$$
This is what confuses me. Why do we square just the operator? To me, that doesn't seem like we are squaring the momentum. I don't understand how squaring the momentum operator is equivalent to squaring the momentum. I believe my confusion stems from a misunderstanding of what momentum is in quantum mechanics and the difference between momentum and the momentum operator.