This should also work for multiline texts. I use a line instead of a rectangle, I hope this is not an issue.
1. Create a text.
2. Create a second text with an animator that only shows your word. Make this invisible. Set the previous text as parent. Set anchorpoint to [0,0] if necessary and position to [0,0].
3. Create a shape layer. Parent it to the first layer, set anchor point and position to [0,0]. Add a path to this shape layer, and add this expression to the Path property (to modify how low is the line compared to the word, modify diff value):
L = thisComp.layer(index-1);
R = L.sourceRectAtTime(0,false);
myLeft = R.left;
myWidth = R.width;
myTop = R.top;
myHeight = R.height;
diff = 5;
p1 = [myLeft, myTop+myHeight+diff];
p2 = [myLeft+myWidth, myTop+myHeight+diff];
createPath(points = [p1,p2], inTangents = [], outTangents = [], isClosed = false)
Here is a project that has all this already built in. The second text takes the text, font, font size and leading from the previous so you don’t have to worry about changing both. To change the underlined wort, change the slider on the main text. The only thing you need to pay attention to is not put any layer between these, because there is an expression using (index-1)