There are probably better ways, but I'd just wrap the first two sections you've outlined in blue in their own auto layout frame.
Thread
like this, the blue outlines are auto-layout frames. Gray boxes are components or whatever else you want to position inside of them.

You can use constraints. Constrain the button top / right. If the parent frame is auto layout, you can set the button top be absolute position