Unity has us covered with Cinemachine! it’s super easy trust me!
You can install cinemachine via the package manager
Once installed, create a new camera, Unity now offers a 2D camera so let’s choose that There’s a slot that tells the camera what to follow so drag the Player into that. Finally, we can specify the camera distance via that option.
Your camera is all setup now to follow the player!