When two things move at once, the question is almost always about the gap between them: how long until it closes, or how big it becomes. Relative speed is the rate at which that gap changes.
Opposite directions (towards or away from each other): relative speed = a + b
Same direction (one chasing the other): relative speed = a − b
Time = gap ÷ relative speed
Think of sitting in one of the moving objects. If a car comes towards you at 60 km/h while you drive at 40 km/h, it seems to rush at you at 100 km/h. If it overtakes you from behind at 60 km/h, it seems to creep past at only 20 km/h.