If the indicators show liquid infiltration, Apple will not replace the iPhone under warranty. They will, however, replace the entire iPhone for a flat fee significantly less than the cost of a new iPhone. If you have AppleCare+ coverage, the cost will be pretty low; in the US it's $49. If you do not have AppleCare+ on your iPhone, see the Service Pricing section here:
There are independent iPhone repair services that may be able to do a repair for less than Apple's out-of-warranty charge. Do a web search for "iPhone repair". Note, though, that if you elect to have the iPhone serviced by an unauthorized shop, all further warranty and support will be voided.