There's been a lot of coverage about illegal immigration on the news in recent years. Turns out, this sort of complicated and polarizing debate on immigration has been going on for hundreds of years. We can see the same sorts of debates floating around in 1890s England, where the increased presence of foreign residents was raising a lot of questions for people. And, in a lot of ways, the Sherlock Holmes stories are a direct response to those questions and anxieties. 1890s England, which was pretty conservative politically, definitely had some xenophobia issues, or fear and dislike of foreigners. It's no mistake that a large number of the criminals in the Sherlock Holmes stories aren't English. In this collection alone, we have criminals and suspects from Italy, America, Australia, Russia, India, South Africa, etc. The crime rates in big cities like London were often tied to debates on immigration and foreigners. And this anxiety extended to English people who spent long amounts of time living in the Empire, in "frontier" places like Australia and South Africa. In a lot of ways, the foreign characters in the Sherlock Holmes stories address contemporary anxieties.
Foreign criminals are actually treated with less anxiety than native English criminals because it isn't all that surprising to the English characters that a foreigner would be a criminal.
Stories like the "Solitary Cyclist" express a lot of anxiety about people returning to England after long stints in far-off imperial territories, which links the Empire itself to issues of crime in this era.