When. Morning and evening, as part of the daily remembrance. Many repeat it three times, following the pattern of the other short morning and evening formulas.
The words. 'Afini is the imperative of the same root as 'afiyah — to be spared, kept whole, left unharmed. It is repeated three times rather than once with a list, and that repetition is doing something. A single sentence naming body, hearing and sight would treat them as one request. Three sentences treat them as three.
Badani is the body as a physical frame. Then hearing and sight are lifted out of it and named separately, in that order — hearing before sight, the order the Qur'an itself uses when the two appear together.
Why these two senses. They are the faculties through which nearly everything reaches a person: instruction, warning, recitation, the faces of the people they love. Losing them is not only a medical event; it closes the routes by which the rest of religious life arrives.
The ending. La ilaha illa ant — there is no god but You — closes a supplication about eyes and ears with a declaration about God. The request is small and bodily; the frame it sits in is not. Repeating the closing line is what keeps the supplication from becoming a health inventory.
A note on health. The supplication does not promise the senses will be kept. It asks. Loss of hearing or sight has been the lot of righteous people throughout the tradition, and this text has never been read as insurance against it.