A few years ago I worked for Auth0 and they made use of a Professional Employer Organization that took care of the logistics and compliance around hiring remote employees in various countries. If I remember correctly, they made use of a company called Globalization Partners [1], but there are plenty of these organizations around.
Auth0's CEO also did a talk [2] a few years back about building a remote workforce and he discussed some of these compliance issues from around the 16 min mark onwards.
[1] https://www.globalization-partners.com/ [2] https://www.youtube.com/watch?v=sfEM0TipgtU