Unfortunately, it looks like there has been water intrusion do to failure of the caulking. The molding is screwed into the edge of the flooring/substrate and due to moisture, the edge of the floor/substrate can no longer hold the screws. To do a permanent repair, you may have to tear apart the interior in both corners, pull up carpet/lenolium, check for mold and treat or cut out the damaged area and replace. Then resecure the molding and recaulk. You can buy new molding and insert from a good camping supply outlet.
__________________
"PT Crew Members Since 9/2010"
2011 RAM 2500 HD 6.7L CTD Crew
2014 Prime Time Sanibel 3250