When the Ukraine military takes a Russian vehicle how do they avoid blue on blue attacks?

There is no one definitive answer to this question. Some possible measures that could be taken include ensuring that Ukrainian and Russian forces are clearly marked and easily distinguishable from each other, having strict communication protocols in place to avoid confusion, and having a clear chain of command so that orders are not misinterpreted.