If you have eye pain with swelling, you should first consider inflammation, such as ocular fasciitis, acute iridocyclitis, endophthalmitis and so on, which may cause such symptoms.
It is advisable to consult an ophthalmologist and have the appropriate tests done to confirm the diagnosis. In addition, you need to observe yourself for other symptoms such as loss of vision and headache and inform the doctor at the time of your visit.