There is a ContentSizeFitter component you can add.
Here’s some more possibly-useful reading as you go into this. Disregarding the notes below may result in you having to completely redo your UI, so it’s worth a look.
Here are the official docs on how to make your UI handle various resolutions and aspect ratios cleanly:
Here are some notes on UI Anchoring, Scaling, CanvasScaler, etc:
Usually you need to choose a suitable ScaleMode and MatchMode in the Canvas Scaler and stick with it 100%. Generally if you change those settings you will often need to redo your UI entirely.