We can apply the Pythagorean theorem separately in both triangles one by one to find the distance of cars from the origin and then to find the distance between them we add both the distances
So for car 1
a^2 = 6^2 + 8^2
a^2 = 36+64
a^2 = 100
square root on both sides
a=10
For car 2
b^2 = 12^2 + 9^2
b^2 = 144+81
b^2 = 225
Square root on both sides
b= 15
So distance between two cars = 10 +15 = 25 miles