Imagine a Cartesian coordinate system with x-axis for time t in hours h and the y-axis for the distance d travelled in km. Both cars are travelling with constant speed. Thus we have two linear functions of the kind y=mx+c, where m represents the slope and c the y-intercept.
Car A has already gone 40km and is travelling at a constant speed of 36km/h. The function, which describes A is:
fA(t) = 36(km/h)*t(h) + 40(km)
Car B starts in the origin of our coordinate system (c=0) with a speed of 48km/h. Thus:
fB(t) = 48(km/h)*t(h)
A) the value of t at the intersection point of the two linear functions fA(t)=fB(t) determines the time it takes car B to catch up with car A:
48t = 36t + 40
12t = 40
t = 3h20m
B) Insert t into one of the functions. As it is the intersection point, they will have the same output at t so it doesn't matter which one you take.
e.g. 48t = 48km/h * 3.3333...h = 160km