Check out example codes for "collision layer an collision mask godot". It will help you in understanding the concepts better.

Code Example 1

Collision mask bit is for choosing what layer should be collided.

Let's assume we set collision layer and mask layer as below.

Player node : collision layer is on 1st bit / mask layer is on 2nd,3rd bit
Enemy node : collision layer is on 2nd bit / mask layer is on 1st bit
Object node : collision layer is on 3rd bit / mask layer is on 1st bit

then,
Player mask(2) == Enemy layer(2)
Player mask(3) == Object layer(3)
so, Player can be collided with Enemy and Object.

but Enemy nodes are not collided each other or Object nodes.
Because Enemy mask(1) != Enemy layer(2) / Enemy mask(1) != Object layer(3)

Learn ReactJs, React Native from akashmittal.com