Escutcheon = the cover plate used over a hole in a surface that exists to allow a pipe/fitting to go through the wall.
Your first picture looks like it's a simple case of the escutcheon needing to be re-caulked. Using a scraper, clean the existing caulk completely from the wall, then apply a new clean bead of bathroom grade white silicon caulk around the escutcheon and hold it in place until the caulk sets. In this case the caulk is both sealant and adhesive.
Your second picture - how loose is the tub spout? Caulk won't hold it in place - too much water pressure on the spout - there should be some kind of set screw or other means of getting the spout up tight to the wall. Once you lock the spout in place, seal it with caulk like with the escutcheon.