Indomethacin works by inhibiting the enzyme cyclooxygenase (COX), which plays a crucial role in the synthesis of prostaglandins. By reducing prostaglandin levels, indomethacin can effectively reduce inflammation, pain, and fever. In neonatal care, its primary use is in closing a patent ductus arteriosus (PDA), a common issue in preterm infants.