If you have a CDMA carrier, you cannot use a phone that is not branded to your carrier. So, in other words, if you have Sprint, you cannot use a Verizon phone (and vice versa).
If you have a GSM carrier, you can use any phone that is GSM as long as it is unlocked. However, depending on the phone/carrier, you might not be able to get 3G. For instance, if you have AT&T as your carrier, T-Mobile branded phones will only get EDGE on AT&T, since AT&T and T-Mobile use different 3G frequency bands.