Optimal control of higher order differential inclusions with functional constraints