Measure the length from box collision

Hello, how do you measure the length of the collided area from box collision?

346409-boxcollision.png

Thanks in advance!