The domain of a function corresponds to the independent variable, whereas the range of a function corresponds to the dependent variable.
Let's take an example.
y=1x
Here, y dependent on x.
∴ The values y corresponds to the range of the function, whereas values of x correspond to the domain.
Here, x can have any value other than 0 as any number divided by zero leads to an undefined number.
∴ The domain consists of all real numbers except 0.
Similarly, the range consists of all real numbers except 0 as 1x will never result in 0.