Not only do the two techniques flavor the food, in some cases they may tenderize it as well. It takes a little planning. Most foods need to steep in a marinade for at least one hour and up to 24 hours for the flavors to set in. Keep one eye on the clock when you're marinating fish and skinless poultry. Be faithful to the time specified in your recipe.
Rubs are different.
Their mission is purely flavor. Typically, you make a paste out of herbs, garlic and spices and rub it all over the food then head straight for the grill or oven. Many marinades and rubs can be made in advance to cut down on the prep time. A plastic bag also works wonders because the food is encased in the liquid. Sweeteners like sugar and honey cut the acidic flavor and provide a rich, crusty surface.