Whether or not you have to go back through security when changing terminals depends on the airport and your itinerary.
If you are connecting from a domestic flight to another domestic flight operated by the same airline, you may luck out and find your arrival and departure gates are in the same terminal. If not, the two different terminals might be connected, or you might have to exit one and enter the new one by going through a security checkpoint.
When you’re arriving in a country (or on a new continent) from a long haul, it’s more likely you’ll need to transfer terminals. Some international laws dictate that upon arriving in the country, you must collect your baggage and go through customs and immigration and then go back through security. Typically, there are expedited lines for connecting passengers with flights to catch, but not always.
Additionally, at many airports long hauls arrive in one terminal and regional flights depart from another (and vice versa) so it’s likely you’ll have to switch terminals between flights, and that means you may have to go back through security if the two terminals are not connected post-security.