If you book a flight with a layover on one ticket, the airline and the airport have approved the connection time. This includes time for changing terminals and passing through security or passport control, if needed.
However, if you book two separate flights on different tickets, you are responsible for making sure there is enough time between the flights. In such cases, you may need to collect your baggage, go through immigration, and check in again.
Always check the airport layout and airline recommendations to ensure a smooth connection.