A 40-year-old man has died in hospital after an ambulance collided with a pedestrian while responding to an emergency call.