Can any country join the EU?
No, only European countries may join the EU. This was tested in 1987 when Morocco’s application was rejected on the grounds that it was not a European country. There is ambiguity as to where the boundaries of Europe end, but Turkey was considered eligible for accession in 1997.
European countries wishing to apply must support the EU’s founding values and be committed to promoting them. They must also meet the criteria of being a free-market economy, a stable democracy, have well-functioning rule of law, and be able to implement EU law and take on the obligations of membership.