Depending on the airport, they will often go off to the sorting office, where either robots or staff will sort them to go off to the right plane, or alternatively be sorted and stored ready for your flight at a later time. During this journey, your bags will be screened at a security checkpoint.