I suddenly thought about these 2 compounds that seem to have the same name. Aren't both of them methyl propanoate? How do we differentiate them apart name wise?
There is not supposed to be a space between the substituent prefixes (e.g. methyl) and the parent structure (e.g. propanoate), so your second structure is methylpropanoate, or more correctly 2-methylpropanoate.
In the ester there is a space between methyl and propanoate, i.e. methyl propanoate.
From context (in spoken word) and/or the presence or absence of a space (in written word). The one on the left is a neutral molecule whereas the one on the right is a charged molecule. In mentioning the given compounds there should be context to indicate a charge. For example, the one on the left is "methyl propanoate", whereas the one on the left would be "2-methylpropanoate" (also called isobutyrate). The isobutyrate would usually be described as an ion (e.g. "sodium methylpropanoate") which would provide clarity as well.
Now it is possible to see the 2-methylpropanoate written as just "methylpropanoate" since there are no isomers to cause ambiguity. In either case, though notice that names for the left molecule have a space between "methyl" and "propanoate" whereas names for the right molecule do not. That is how you can tell between an ester from an anion.