‘In time’ usually has an implicit ‘for (some event)’, whereas ‘on time’ means ‘before some deadline’. The ‘event’ could be a deadline, but in that case ‘on time’ is much more common.
I got there in time ‘meaning’ in time for some event which is assumed to be known’.
I got there in time for the express bus to the city.
I delivered the coffee in time for her to drink it before the exam.
I got to the airport in time (for)/(to catch) the last flight to Sydney.
I got there on time, meaning ‘before the deadline’, which may be known to the hearer, but does not need to be, because the phrase itself implies a deadline as opposed to some other event.
The express train is scheduled to arrive on time at 10:10AM.
Despite the bad weather, the project was completed on time.