In English, "a" becomes "an" when it is followed by a word starting with a vowel sound. A similar thing occurs in Spanish with the word "y", which becomes "e" when preceding a word starting with an "i" sound.
I have searched online and have found educational resources about which situations these specific substitutions are made in. But I haven't been able to find any information about this phenomenon in a broader sense.
Is there a general term in linguistics for words like this, which are replaced by other words in contexts where the next word starts with a particular sound?