Just as there are surnames that are very common (such as Phillips) and surnames that are uncommon, there are Haplotypes (a set of results that characterize you on the Y-chromosome) with a high frequency of occurrence (aka common) and Haplotypes with a low frequency of occurrence (aka uncommon). The 12 Marker result from the Y-chromosome test is called a Haplotype and can help determine if your DNA sample is common or uncommon.
When you compare a 12 Marker result to another 12 marker result of someone with the same surname and the results match 12/12, there is a 99% probability that you two are related within a genealogical timeframe. If the match is 11/12, there's still a high probability that you are related if the 11/12 match is within the same surname.
If you compare the 12 marker result to someone else who does not have the same surname, but the scores match, you are most likely NOT recently related. When we use the term recently related, we are talking about a time frame within the last 1000 years or 40 generations, a period that includes the earliest known use of surnames.