Query string for messages list returns inconsistent results compared to web interface
Yes, message body is searched.
Try: "from:example.com OR to:example.com"
No, Gmail UI and API search is not case-sensitive.

Be aware that service.users().threads().list() would be more consistent with Gmail UI search assuming the user has conversations enabled which is the Gmail UI default.
in:anywhere expands the search to Trash and Spam which is not normally included. Archived messages are normally included.
When I use code similar to the example code from the api documentation, the query strings which in the web interface return results don't work. This is listing messages, not retrieving them, so I don't think full vs raw helps. The scope granted is gmail.readonly 

Is it possible to search on message body with this function?
Is there a way to search on domain name (i.e. all messages from or to *@example.com) 
Is the search case-sensitive?

service.users().messages().list(userId=user_id, pageToken=page_token, q=query).execute()
I use 'me' for the user_id, and I checked that it's certainly the same email. A Query for in:anywhere on its own returns the full mail list.
Thanks for the help!
EDIT: The query in question is a single word like a name. Some of them sometimes work with 'name is:anywhere' but not consistently.