In a composite function f [g(x)] the following condition must be true
Range of g(x) ⊆ domain of f(x)
The function f in f(g(x)) gets the values that are given by g(x) as output. So all values in range of g(x) should be in the domain of f(x). If this is not the case g(x) will give values for which f(x) is not defined, and as a result f(g(x)) will not be defined for those values of x.
So the condition Range of g(x) ⊆ domain of f(x) will make sure that every value in the range of g(x) is in the domain of f(x).