Defect refers to any deviation from the specifications mentioned in the product functional specification document. A defect results in a deviation in the actual and expected result of the application.
Failure is when a product is completed and is delivered to the customers and the customer finds an issue in the product or software.