I would use interp1 to interpolate both functions so they have the same high resolution x support. You can easily replace the 0.01 step by a 1e-6 step size in the code below.
Look for interp1 options, to control the interpolation algorithm (you might prefer 'linear' to avoid overshoots), and to control extrapolation (in your probability distribution case, you might want to set the value for extrapolation to 1 if one of your distributions has shorter x range).
Then use trapz to compute the signed integral of the difference or unsigned area between the curves. See code.
my_signed_integral = trapz(xq,y2q-y1q)
my_unsigned_area = trapz(xq,abs(y2q-y1q))
test_signed = trapz(xq,sqrt(xq) - xq.^2)
test_unsigned= trapz(xq,abs(sqrt(xq) - xq.^2))