I sometimes need to access the anchor as a block attribute using parse_blocks. I do so my saving the value of the anchor as an additional custom attribute. (Saving it with the attribute name “anchor” breaks all blocks which haven't been converted yet.)

https://github.com/markhowellsmead/helpers/wiki/WordPress-block-filters#save-the-heading-blocks-clientid-as-a-block-attribute