Porters and stouts seem very similar and sometimes stores and restaurants group them together as if they're two different names for the same thing.
Is there a difference and what is it?
Beer Connoisseur Online answers this pretty thoroughly in an article.
The TLDR: is that "...originally a stout was a strong version of a porter. Today, the difference is whatever you want it to be."
For an interesting history on the term Stout and the style of beer, you can check out this history of stout article provided by Eric Deloak. Similarly you can read a history of porter article written by the same author: Gregg Smith
There are a number of different types of porters and stouts, so it isn't necessarily a simple answer, but I would say the use of roasted grains in stouts, particularly roasted barley, is the biggest difference. As such, you end up with more burnt toast and coffee type flavors in a stout, but the amount and type of roastiness depends upon the type of stout. If you get the chance, try a side-by-side comparison between the regular Guinness and the Guinness Foreign Extra stouts where the regular Guinness comes off more roasty than the Foreign Extra.
Most porters have little to no roastiness. I think of them as having more smoother chocolate-type flavors, and to be lighter in color (deep red or ruby as opposed to black), but there is a lot of overlap in the Venn diagrams between the two.
Well, that style thing is complicated because in real world people just make beer, and don't make beer to satisfy styles guides (at least, not until very recentely when some people started to care more about style guidelines than the beer itself).
Anyway, what I think is important to be aware is:
So, I think it makes more sense telling the difference between a milk and an outmeal stout, or brown and baltic porter than stout X porter.
For what's worth, for me, there's no difference between stout and porter. What I mean is, at least not so that we, as consumers, can trust and be 100% of what you are going to get if you choose one over the other, specially when the name is generic like that.
What I think is enlightening is to understand the history of those related styles and how they came to be what they are today.