I saw this this question, and a few others, but there aren't any explanations I can find that say whether the two are treated differently or not. In other words, can they be used as a direct substitute?
It depends on what you mean by "yam".
Once upon a time, in the deep south of the US, there was a tuber known as the sweet potato, and it was good. And then one particular grower decided to sell theirs under the trade name "yam" to get better marketing recognition. This lead to some folks in the US calling sweet potatoes by the name yam, especially in the context of candied yams (a sweet casserole of spiced sweet potato).
So if the word "yam" is being used to mean a variety of sweet potato, then they are culinary identical. Sweet potatoes of all variety are, well, potato sized (or a bit bigger than the average potato), and their color can range from whitish through yellow, orangish or reddish. Most grocery store varieties are fairly orange in color.
True yams originate from Africa, and are far more starchy and fibrous than sweet potatoes, no matter what they are called, and are used in entirely different ways. They can be very large, football to basketball sized or larger. There are also a tremendous variety of true yams.