When you register a domain name, it doesn’t automatically gain trademark rights. You only acquire trademark rights if your domain name is distinctive through customer awareness and you are the first to use it in commerce. Amazon.com is a good example.
If you’ve chosen a domain name and it’s available, you should probably do a quick trademark search to see if there’s a direct hit. If you don’t get a hit, you might consider buying it because someone else might beat you to it first. Names don’t cost much. If it turns out that it violates someone else’s trademark, you can always transfer it to them (but beware of trademark dilution). Then you can do a more thorough search. If you get a hit, you can go back to the drawing board.
If you’ve found a good name, but someone else has already registered it and is using it as a trademark, then you should move along and choose something else. If they’re not using it as a trademark, you can always offer to buy the domain name from them.
If you already established trademark rights and someone has taken the domain name based on your trademark primarily for the purpose of selling it to you, they are a cyber-squatter. You may sue them in federal court or use a procedure through ICANN to force them to transfer the name to you.
One other thing about the internet. If anyone, anywhere can purchase your goods or services through your website, then the trademark on those goods or services is more than likely given national protection. The same is true of a mail order business in a national magazine.