The analogReferece() sets the reference voltage for analog input. It just sets a global variable.
The analogReference() is defined in hardware/arduino/avr/cores/arduino/wiring_analog.c as below.
The input is mode and its type is uint8_t. The mode can be one of ‘DEFAULT’, ‘INTERNAL’ or ‘EXTERNAL’.
This function stores the mode into the global variable named analog_reference. The analog_reference is used in analogRead().
Arduino AVR core 1.8.3
May 15, 2021