You may have heard some definitive distinction that seperates these two styles but whoever told you that was probably just passing along nonsense.
Roasted barley. That’s the usual explanation of what separates porter and stout. Unfortunately that story is total bollocks.
Indeed it is. The line between these styles is actually quite blurry and the history is quite fascinating, as this article from All About Beer points out.
After 1880, when the use of unmalted grains was permitted, a new coloring material arrived: roasted barley. (Before this date brewers were liable to a heavy fine for having any unmalted grain – with the exception of oats to feed their horses – on their premises.) London brewers weren’t all enthusiastic. Some used it and some didn’t. Those that did used it in all their black beers, porter and stout. For a very good reason.
The article sums up what I usually tell people, but even then it’s not exactly a complete picture of what is happening stateside:
The difference between porter and stout? All stouts are types of porter. But not all porters are stouts. Only the stronger ones.
Close enough to move on. The whole article is worth a read–fascinating history to be sure.