Suppose we have potential $V(x) = \delta(x)$. I want to evaluate $\langle x' \vert [p^2, \delta(x)] \vert x'' \rangle$. Unprimed quantities are operators while primed quantities are eigenvalues/eigenstates of the position operator.
My attempt is below. I am confident in the working, up until the final step where I assert the result is zero, based on a hand-wavy pseudo-mathematical argument. My physical intuition tells me that the commutator should be non-zero, because this question arises directly from asking whether the Hamiltonian for a particle subject to a delta-potential commutes with the free particle Hamiltonian (and I would think not).
The ask is to check/correct the mathematical working (right at the end) based on this disagreement between the answer I expected (not zero) and the answer I obtained. The justification for asking this question is that I don't know how to handle this type of integral and my book (Sakurai) doesn't seem to cover it.
$$\begin{align} \langle x' \vert \delta(x) \vert x'' \rangle &= \langle x' \vert \lim_{\sigma -> 0} \frac{1}{\sqrt{2 \pi \sigma^2}}\exp\bigl(\frac{-x^2}{2\sigma^2}\bigl) \vert x'' \rangle\\ &= \lim_{\sigma -> 0}\frac{1}{\sqrt{2 \pi \sigma^2}}\exp\bigl(\frac{-x''^2}{2\sigma^2}\bigl) \langle x' \vert x'' \rangle \\ &= \lim_{\sigma -> 0}\frac{1}{\sqrt{2 \pi \sigma^2}}\exp\bigl(\frac{-x''^2}{2\sigma^2}\bigl) \delta(x'-x'') \\ &= \delta(x'') \delta(x'-x'')= \delta(x'') \delta(x'), \end{align}$$
$$\begin{align} \langle x' \vert p^2 \vert x''' \rangle = (-i\hbar)^2\frac{\partial^2}{\partial x'^2}\delta(x'-x'''), \end{align}$$
$$\begin{align} \langle x' \vert \delta(x)p^2 \vert x'' \rangle &= \int{\langle x' \vert \delta(x) \vert x'''\rangle\langle x''' \vert\ p^2 \vert x''\rangle dx'''} ,\\ \end{align}$$
$$\begin{align} \langle x' \vert p^2 \delta(x) \vert x'' \rangle &= \int{\langle x' \vert p^2 \vert x'''\rangle\langle x''' \vert\delta(x)\vert x''\rangle dx'''} ,\\ \end{align}$$
$$\begin{align} \langle x' \vert [\delta(x),p^2] \vert x'' \rangle &= \int{\langle x' \vert \delta(x) \vert x'''\rangle\langle x''' \vert\ p^2 \vert x''\rangle dx'''} \\ &-\int{\langle x''' \vert\delta(x)\vert x''\rangle \langle x' \vert p^2 \vert x'''\rangle dx'''} \\ &=\int{\delta(x''') \delta(x'-x''') (-i\hbar)^2\frac{\partial^2}{\partial x'''^2}\delta(x'''-x'') dx'''} \\ &-\int{\delta(x'') \delta(x'''-x'') (-i\hbar)^2\frac{\partial^2}{\partial x'^2}\delta(x'-x''') dx'''} \\ &=\int{\delta(x''') \delta(x'-x''') (-i\hbar)^2(-1)^2(2!)\frac{\delta(x'''-x'')}{(x'''-x'')^2} dx'''} \\ &-\int{\delta(x'') \delta(x'''-x'') (-i\hbar)^2(-1)^2(2!)\frac{\delta(x'-x''')}{(x'-x''')^2} dx'''} \\ &= 0. \end{align}$$
The (false) hand-wavy argument: intuitively, the only non-zero contribution will come from $x' = x'' = x''' = 0$ and the divergent contribution of the denominators will be the same in each integrand. The integrands will then have the same "values" and cancel (whatever this "value" really is).
For the derivatives, I have used the expression $x'^n \delta^{(n)}(x') = (-1)^n (n!) \delta(x')$, where $f^{(n)}$ denotes the nth derivative of $f$. I chose this identity because the integrals include multiple $\delta$-functions, so the usual integration rule with a single $\delta$-function multiplying an "ordinary" function did not seem applicable. Thus the appeal to intuition above.