what makes a sentence grammatically correct when using the verb SER versus using the verb ESTAR

SER is usually for occupation, weather, nationality, and permanent subject matter like those.
ESTAR is more for location and feeling.
For example, you say "?Dónde está Raúl?" Because it's asking his location.
Same goes for "Yo estoy enfermo" Meaning, I am sick or ill.
"Yo soy Americano" Is using the verb SER for nationality. "I am American"
Both verbs are "To be" but they're used for various different scenarios. Hope this helped.