On the Java Edition, you break them instead, as you can break them in survival mode, which aligns with the intended behavior as per MC-102908, although in my opinion, they shouldn't be breakable.
This behavior isn't considered a bug. There's no reason why you shouldn't be able to mine blocks while riding a boat. The entity you're riding is consistently untargetable, allowing you to interact with blocks or entities by aiming through it.
On the Java Edition, you break them instead, as you can break them in survival mode, which aligns with the intended behavior as per MC-102908, although in my opinion, they shouldn't be breakable.