Five years back I had an experience of rubbing penis with clothes to anus of someone (not in but might touch pink area)genital warts now HIV can be?

HIV. This is not how HIV disease is transmitted. You must have intimate contact, either sexually (and this can include vaginal, anal and oral sex), or by blood or tissue transfer. Being tested for HIV is an excellent idea for anybody who has ever had unprotected sex and you might want to do this. Better safe than sorry.
HIV is Hard To Get. I understand how our brains can sometimes take us to places of extreme worry. Hiv infection is not in any way possible in the situation you describe. You do not even need a test unless getting an HIV test will help you feel better. Warts usually come from skin to skin contact and it is often the story that one has them on their hands before their genitals. But, again not through clothes.
Need to get tested. The risk for HIV is low but you may have been exposed to other sexually transmitted infections, like syphilis, lgv, hpv etc. You should see your doctor to get tested so that you can have peace of mind and/or get treated, if needed.