Uber and Lyft are licensed livery cabs in NYC. Livery cabs are not allowed to accept street hails, but are allowed to be ordered for pick up in other ways (such as through a phone call). The only way that they would be illegal is if you believe that ordering through a phone app is more similar to street hailing than it is to ordering through a phone call, but I think that is a huge stretch.