Geometry of q-hypergeometric functions as a bridge between Yangians and quantum affine algebras