They can be "synonymous enough" in most sentences, but they don't literally mean exactly the same thing.
For example, these sentences have similar enough meaning to be used interchangeably most of the time:
- "I ask myself why am I doing this."
- "I wonder why am I doing this."
But they are imperfect synonyms, because wondering is more passive, and is a central thought process, but asking is more assertive, and is a beginning to a process of checking. For example, these sentences have slightly different meaning:
- "I ask myself why am I doing this, so I wonder what the answer is."
- "I wonder why am I doing this, so I ask myself what the answer is."
While they have very similar meaning, the first sentence implies I begin assertively enquiring, then I become passively unsure. The second one implies I begin passively unsure, then I become assertively enquiring.
Very subtle stuff, I wouldn't worry about it to be honest. You could treat they as practically synonyms, with slightly different emphasis between them.