Yes and no.
They both do the same job essentially. But they do it in different ways. A planer will take off large amounts of stock in a short amount of time. A sander will take off small amounts, but leave the surface free of milling marks. Unless you get a very powerful sander you will need both machines. A three head sander will almost eliminate the need for a planer. That is, of course, if you are willing to part with $50K+.