You want the big digits leading and the two numbers as close to each other as possible. If the total number of digits is even the two numbers will each get half the digits. Sort the digits and distribute them in pairs between the two numbers. As soon as you have a difference, the one that got the larger of a pair gets the smaller of all subsequent pairs. If your digits were $9,9,9,8,8,8,7,6,5,4$ you would start with $99****$ and $98****$. The larger of each subsequent pair goes to the $98$ so you get $99864$ and $98875$
If the number of digits is odd you do the same, but the first discrepancy goes in favor of the shorter number, then all the rest go to the longer. This says $9,9,9,8,7,6,5,4,3$ would be split $9964$ and $98753$