You can glue it or you can disassemble the phone and remove the screen with a hair dryer and replace the adhesive. Don't replace it if it's not broken. The teardown on iFixIt will explain how to tear it down and remove the screen, but you'll need to buy an LCD adhesive sticker for it if you do that.
To just glue down those areas, which will work fine if you do it right, you'll need:
- Clear 2-part epoxy, preferably the 5 minute stuff
- Some toothpicks, preferably the round pointy ones
- Isopropyl (rubbing) alcohol)
- Cotton swabs to hold the alcohol
- Razor blade
- A few clothespins, but not the super-tight grip ones
Clean the phone around where the LCD sits. Try to clean where the opening is, but don't use too much alcohol and don't force the LCD open as you can crack the glass. Make sure that you can "close" the gap between the screen glass and the phone frame by squeezing gently with your fingers. If the screen doesn't close something is lodged behind it. Don't force it. You'll have to completely disassemble the phone and remove what's behind it.
If all is well mix a small amount of epoxy on a piece of paper or similar and use the toothpick to push a small amount of epoxy in at a few points along the edge where it's separating so that a few dots of epoxy are under the glass. You need very, very little. An amount of epoxy that would be equivalent to a single drop of water would be enough to hold the whole screen down. Just use a few tiny drops. Then close the screen with your fingers, wipe off any excess epoxy with some alcohol and a swab, and use a couple clothespins to hold the screen closed for a few hours to fully set. If you have excess epoxy on the screen once you're done use the razor blade held at about a 45 degree angle to scrape off the excess.