This was better. You need to split the integral before you look at substitutions. I would do the first integral from ##0## to ##3/2## and the second from ##3/2## to ##3##, say. That seems a lot neater.
Then you can use the ##y## substitution. Although, there is also a trick to leave the x-function as it is. Since you are not going to integrate it, it won't change. This is what I mean:
With ##y = x^2 - 3x + 2 = (x - 3/2)^2 - 1/4## and ##dy = (2x - 3)dx##
##\int_0^{3/2}(x^2 + 1) \delta(x^2 - 3x + 2)dx = \int_2^{-1/4} \frac{x^2 +1}{2x-3} \delta(y) dy = -\int_{-1/4}^2 \frac{x^2 +1}{2x-3} \delta(y) dy = -\frac{x^2 +1}{2x-3}|_{y=0} = -\frac{x^2 +1}{2x-3}|_{x=1} = 2##
Notice that because ##2x-3 = -1## you get same answer,. This is a coincidence. If you change the quadratic it won't be the same.