Look up how to set resolution or to letterbox your game. If you want your game to handle all screen sizes, check here:
The first is UI. The answer is all in anchoring and scaling properly.
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.
The second is your game sprites, if they are not UI. Look into how to align things with the edges of the screen based on your camera settings. You can also use a package like Cinemachine that will help you frame all parts of your game.