you state that in either case the first digit is always 0 so I wonder if the below Custom Format would work for you ?

[>99999999]000-000-0000;000-000-000
of course the above assumes the numbers entered are numbers (which might not be the case) - eg 12345678 would be 012-345-678 and 123456789 would be 012-345-6789