My Gui elements look perfect when Maximize on Play is not clicked. But if I change the resolution or click Maximize on play the gui elements are all over the place. Especially the buttons within a panel. How can I fix this?
Under the Rect Transform component of your UI elements you can set the Anchors using which you can set the position based on specific anchors using which that particular element will be placed.
See image below for reference:

You can also watch this THE NEW UI for better understanding.