Responsive setups

Lower-thirds

2-liner with conditional sizing (left-aligned text)

// null layer "controls"
// 1. Create 2 layer controls and select text layers;
// 2. Create 3 point controls: "heightWidth","heightWidthWithPad", "padding"
// "heightWidth" point control expression
t = effect("Layer Control")("Layer").sourceRectAtTime();
t2 = effect("Layer Control 2")("Layer").sourceRectAtTime(time - 1);
y = 50; // height of textbox
t.width < t2.width ? [t2.width, y] : [t.width, y]
// "heightWidthWithPad" point control expression
effect("heightWidth")("Point") + effect("padding")("Point")
// Rectangle shape layer "textbox"
// SIZE
thisComp.layer("controls").effect("heightWidthWithPad")("Point")
// LAYER ANCHOR POINT
s = sourceRectAtTime();
[s.left,s.top] // left align
[s.width/2,0]; // right align,right align your text layers in the paragraph panel & reposition everything as needed.
// Line 1 text justification
//Put a "Tracking" parameter text animator onto your text layer with this expression
padding = thisComp.layer("controls").effect("padding")("Point")[0];
numChar = text.sourceText.length;
padding/numChar;
// This will justify your line 1 to the textbox, provided that line 2 is shorter