The domain of a function is the set of values that can be taken by the independent variable. Here y = |x - 2|, the independent variable is x.
The set of values that x can take is R.
As the absolute value of any number cannot be negative, the range of the function is [0, inf.)
The required domain is R and the range is [0, inf.)