You both sit down prior to the trip & estimate the overall expenditure. When the estimate has been achieved for the grand total, split the total. Then decide how you both will disperse the money using an agreed method or many - via: prepaid cards, cash, app.
What this will achieve is it will uncover whether both of you are on the same page for how much the trip might cost, remove as much uncertainty for channeling money around, & also lays out a rough agenda (itinerary) that could may impact each others schedule.
A good friend should not require a written contract or some drafted agreement, but communication is always good to exercise in order to maintain a good relationship. Both should sorta assume that it will cost more than expected & to accept without resentment a small amount of the other person's potential excessive spending (forgot the wallet, card in the other jeans etc etc)
__________________
-Oh Hey!