iPhones come with a 1-year warranty from Apple. The warranty covers manufacturer's defects. It doesn't cover liquid damage. If you purchased AppleCare+, it comes with replacements for damage at a small cost. But, replacing a phone with liquid damage is never free.
You do not have to have dropped your phone in liquid for it to be liquid damaged. Liquid could have splashed on it. A water bottle could have leaked in the same bag as the iPhone. You could have been somewhere like a sauna. The phone has sensors in it called "liquid damage indicators" that tell a repair person if liquid has entered the phone. That, combined with other signs, such as corrosion, tell them that the damage is from liquid.