All Apple USB-C chargers support USB-PD, the power delivery specification to select a safe voltage for the connected device. The voltages supplied are 5V, 9V, 20V, and sometimes something in the middle somewhere like 14.5V. The current supplied at each voltage will be somewhere between 2 an 3 amps at the lower voltages, the higher voltages come with higher current from 3 to 5 amps.
Here’s some educated guesses and close approximations at what volts and amps the different Apple, and non-Apple, USB-C/USB-PD power supplies will provide.
12 watts: 5 volt @ 2.4 amps
18 or 20 watts: 5 volt @ 2.4 amps, 9 volt @ 2.x amps
27 watts: 5 volt @ 2.4 amps, 9 volt @ 3 amps
29 or 30 watts: 5 volt @ 2.4 amps, 9 volt @ 3 amps, 15.2 volt @ 1.x amps, 20.4 volt @ 1.x amps
45 to 61 watts: 5 volt @ 2.4 amps, 9 volt @ 3 amps, 15.2 volt @ 3 amps, 20.4 volts @ 2.x amps
82 to 96 watts: 5 volt @ 2.4 amps, 9 volt @ 3 amps, 15.2 volt @ 3 amps, 20.4 volts @ 4.x amps
The older iPhone might not know about USB-C but the charger knows that it will provide only 5 volts unless the iPhone asks for more. Newer phones and laptops will ask for more, up to the maximum power it can take or the maximum the power supply can provide.
A pattern you may notice is that they wanted to keep the current between 2 and 3 amps, if more power was needed then step up the voltage first, and exceed 3 amps only once 20 volts is reached. This was to keep cable costs low since a 5 amp cable had to use more material and be built to handle more heat. There was also a preference for lower voltages as that kept the material costs low as well.