The UK, for one, has a program which is probably a sort of remnant of its past EU membership where the government provides legal aid in European countries, (incl. EU, EEA and other countries) including paying for a legal representative if one is accused of a crime. For example, if a UK citizen is accused in Ukraine, they can be paid for a lawyer there. (See: Legal Aid — Legal problems abroad)
I found that the EU has a program with similar geographic scope; however, it relates only to its own jurisdiction except for Denmark — applications can be filled out in a form. (See Form of Legal Aid Application in another Member State of the European Union)
Is there a program of the EU that functions in a similar fashion outside of its jurisdiction or in 3rd countries?
Specifically, can an EU citizen, within EU protocol or as a matter of EU law, apply for or request an attorney to represent them if accused of a crime? If so, through what procedures and based on what law?