You can extract the numbers, that you want to sort by, from the string, e.g. by splitting the string. Then use them as keys for sorting. After that build the string again.
import rhinoscriptsyntax as rs
from operator import itemgetter
dat = list()
for item in l:
n0, n1 = item.split("UB")
dat.append((int(n0),float(n1)))
dat = sorted(dat, key=itemgetter(0,1))
a = ["%sUB%s" % (n0,n1) for n0, n1 in dat]