Measure object depth with ray_cast
You can use mathutils.geometry.intersect_ray_tri to check any intersections with object triangles.
You can use the raycast method and then again with normals inverted to get the opposite face