Yes, I have tried both. However the only ANC I have experience with is AirPods Pro, so that's all I have to go on. But I can definitely say that IEMs do a better job than the AirPods.
Shure SE215 and the default tip it comes with. I can only speculate on why the IEM is better, but I suspect it comes down to the tip material creating a better, more substantial seal. The outer shell is also physically larger, and that may also play a role in keeping more sound out.
I wonder if we can replace the tip on the Airpods Pro to create and IEM like seal. I suppose that should be the best of both worlds? But the outer shell would still be smaller so maybe not.