Based on the definition of prefixes and suffixes, I think "under" is a prefix in the word "underdog" but not in the word "understand". This is because from their meaning, "an underdog" is a predicted looser of a competition while which denotes they're inferior or they're under. In the word understand, the word "under" doesn't denote anything beneath or anything under.
I don't think my explanation is as clear as you'll want it to be. I don't want to give you a clear answer without letting you see the rules in which I used to obtain those answers.
Similarly, the word "wards" in "afterwards" is a suffix in "afterwards" this is because "afterwards" denotes a point in the future.
Hope you get the point? If not let me know so I can use a more formal approach.
hope it helps?
Best Regards!