The first sentence could mean that the name of the place is "Some Name" or "Some Name by the XYZ". In the first case, the place is located near "the XYZ". In the second, "by the XYZ" is part of the name.
Quote marks can help disambiguate which you mean.
Here are a couple of examples of the first type:
NOTE It didn't occur to me that the OP may have intended XYZ to be the name of the people who call the place "Some Name". @FumbleFingers notes in comments to the OP that "known by them as" is not a popular construction. In any case, I took the XYZ in "by the XYZ" to be a place holder for the name of a reference location - e.g. "by the river" or "by the mountain".