There is a lot of ways this can be made faster. One is to not cast the rays as far, since far apart objects wouldn't be colliding. Also only lines that hit should be considered for picking the closest from. Actually you'd want to use math to calculate the raycast points which may be faster than doing a looping collision check, and will be a lot more accurate.
Another thing you could do is only do this after a collision actually occurred. So the flow would be:
1. object overlaps another.
2. move object back to previous position
3. Ray cast collision points to find point of collision.
The only drawback of that is there is no expressions to access the collision points.