One way is to make a copy of the foreground text, insert a stroke to it and use the stroked copy as opacity mask to make the background text transparent under the foreground text. Texts can be edited again after releasing the opacity mask.
Two texts on an image (which is here only a flat grey rectangle)
The foreground text is copied to clipboard as is, a white stroke is inserted to the original
The fill color of the foreground text is changed to white
The foreground text is defined in the Transparency panel to be the Opacity mask for the background text. Used options: No Clip, Invert Mask. Now there's a hole in the BG text
The original foreground text is pasted to place
If you are making a logo or need to for example cut out the text in vinyl, then it is a good idea to make everything as clean outlines. It´s a bit tricky to explain so bare with me. The "top text" is the one blocking the "bottom text"
- First convert the texts to outlines "ctrl+shift+O"
- Make a copy of the top text and add outline to that.
- Then expand (Object/Expand appearence) the copied text and use "join" in the pathfinder window to make it a outline object again.
Select the copied text and the bottom text and use "Trim" in the pathfinder window.
Direct select and delete all of the copied text parts.
Now you have cutouts in the bottom text.