Functions on surfaces and constructions of 3-, 4- and 5-manifolds