How to stop objects sticking out from the sides
One way to fix this:


Select your mesh
Switch to Edit Mode
Select all
Press P then choose 'By loose parts'. This will divide the mesh by loose parts.
Switch to Object mode.
Select the objects (parts of mesh) which you want then delete them.
Select all remaining mesh parts using A
Join them to be one mesh using Ctrl+J