The best way to do this is in character. Generally, the PCs do not know item rarity and may not be able to appraise the value of everything. That means it can get tricky to be fair.
In the past, when PCs ran into trouble with treasure division, the best method I've encountered was to divide a small amount of the coin evenly during the adventure (for expenses), but to hold the items, jewelry, gems, art and coins to divide after an adventure. Someone might test out an item during the adventure, but it goes back in the pool at the end when it is time to divide up the treasure.
Then, at the end, all of this treasure is identified (if they can), appraised (as best they can) and laid out. The coins are divided into 10 equal amounts. The small gems, jewelry and art are divided into groupings about the same value as the coin stacks where possible, but if the individual items are worth more than the coins, they go into a separate one item group. All magic items are a separate group. Obviously, they have to guess value if they can't appraise, so there can be some discussion there - but later steps make it fairly irrelevant if they get this correct or not.
Then, the PCs take turn adding to stacks. They take either one of the items, a group of coins, a group of gems, etc... and add to an existing stack, or they start a new stack with it. This means that you'll have at least 10 groupings to add to the stacks from the coins, but you usully have more than 20. However, you may just have a handful of stacks if they make them big, or a lot if they keep them thin. If there are powerful items, the stacks tend to concentrate to equal out the values. If not, they can spread out or stack up... it all tends to even out pretty well.
*After everything is in stacks* the characters determine a random 'draft order' and then proceed to draft stacks in a snack draft (1,2,3,4,5,5,4,3,2,1,1,2,3,4,5...) until it is all gone. Before they draft, they occasionally 'trade draft picks'. (Bob, if you give me your first pick, you can take all the rest of my picks after the first round).
If a PC wants a particular magic item, they'll put it in a separate stack (generally) and hope it is there for them to draft. Sometimes someone will set up a stack that they think nobody else will want, but find another PC drafts it to sell (either to the PC that wants it or to an NPC).
All of this can be done in character. It uses the information the PCs have rather than book information. It is also (usually) fun.
As this is done in character, there may be cheating. The rogue might attempt some slight of hand to manipulate the random choice of draft order or move something from one stack to another. The wizard may lie about what an item is after identification. The appraiser in the group might fudge the value of a gem.
However, it is all in character.
There are modifictions that can be agreed upon. Sometimes the PCs agree that an item is best for the group when in one PC's hands and give it to them outside this process. Sometimes they all agree a PC can 'buy' an item from the pool before this process begins at an agreed upon price. Spell scrolls are often lent to the wizard to copy into a spellbook before thy are divided up. If there are a lot of coins they might divide them into more than 10 groupings. Sometimes a PC was off the charts awesome in an adventure and the group lets that PC get an extra pick or get to choose their place in the draft order.
This system has been used a lot over the decades, but it is not the most common system I see. Most often, we just divide the coins/jewels equally and talk trough who should get items. It is not perfectly equitable, but it is what is best for the team.