sortieren
to sort
To arrange, group, or put objects, data, or information in order according to certain criteria.
Bitte sortiere die Briefe nach dem Postleitzahlen.
Please sort the letters by postal code.

to sort
Loading your saved state.
to sort
To arrange, group, or put objects, data, or information in order according to certain criteria.
Bitte sortiere die Briefe nach dem Postleitzahlen.
Please sort the letters by postal code.

If you want to specify the criterion by which something is being organized, use the preposition 'nach' followed by the dative. This pattern is very common.
Die Kinder sortieren die Bausteine nach der Farbe.
The children are sorting the building blocks by color.
'Sortieren' (to sort) is often used for everyday organizing tasks. Typical objects are 'die Wäsche' (the laundry), 'den Müll' (the trash), 'Fotos' (photos), or 'E-Mails' (emails).
Am Wochenende muss ich unbedingt meine alten Fotos auf dem Computer sortieren.
At the weekend, I absolutely have to sort my old photos on the computer.
The verb can also be used reflexively: 'sich sortieren' (to collect oneself). This means that a person organizes their own thoughts or feelings in order to be able to think clearly again.
Gib mir eine Minute, ich muss mich nach dieser überraschenden Nachricht erst mal sortieren.
Give me a minute; after this surprising news, I first need to collect myself.
to separate
'trennen' and 'sortieren' can both mean that you do not simply leave things together. 'trennen' emphasizes that different types are separated from one another, for example paper from plastic. 'sortieren' emphasizes ordering things according to a system, for example by date, color, size, or topic. Learners may confuse the words because when you sort things, you often also separate them. If the only important point is that things are being separated, 'trennen' fits. If a clear order or sequence is created, 'sortieren' fits better.

Am Abend sortiert Ali die Rechnungen nach dem Datum.
In the evening, Ali sorts the bills by date.
Ihr trennt den Müll heute bitte in Papier, Plastik und Glas.
Please separate the trash today into paper, plastic, and glass.