There are a number of ways of removing the backgound of an image. The method you use depends on the kind of image and your skills. You should always work on an image non-destructively, using (for example) a layer mask, so you can return to to the image and undertake more work on it, if necassary.
There are a lot of tutorials available – have a look at the newish Select > Subject feature – it's amazing..
It is hard to know exactly what is the problem without seeing your image or your settings. Photoshop does not analyse an image knowing foreground or background, it is not real magic, even if that is the name. It looks for areas similar to the area you erase, if the area you are reasing has much noise or is many different colours removing the background with magic eraser may not work. It works best for removing flat colour background (and is seldom used proffessionally, since there are better ways of removing background non destructively). The tolerance setting is going to have big impact.