Giraffes do use their long necks to browse leaves, at the tops of acacia trees - but such current function, no matter how vital, does not prove that the neck originally evolved for this purpose. The neck may have first lengthened in context of a different use, and then been coopted for better dining when giraffes moved into the open plains. Or the neck may have evolved to perform several functions at once. We cannot learn the reasons for historical origin simply by listing current uses.
Stephen Jay Gould