If you book a flight with a layover both the airline and the airport have approved the switching time. Time to switch terminals and security is part of the layover. If you book two separate air routes, however, you must ensure that the time for changing flight is sufficient.