I had a similar issue when I first started using the Airpods Pro. ANC was working and I kept switching back and forth between that and transparency for testing. Then all of the sudden ANC was not turning on in the earphones, even though I could select it in the iPhone volume settings. Holding earphone sensor didn't give the tone to switch modes, either.
I ended up putting them back in the case for a few minutes then put them back in my ear and then ANC started working again.
Oh, and when I was having the issue I could hear that ANC was enabling right when I started a ear fit test and then ANC would turn off when fit test completed.