As of this writing, there are three known worms out there for the iPhone: Ikee changes your wallpaper to Rick Astley, iPhone/Privacy.A pores through all your personal information, and the third as-yet-unnamed worm copies your personal data and redirects online banking customers of a Dutch bank to a fake phishing website.
If your wallpaper has a underneath the text "ikee is never gonna give you up", your iPhone is infected with the Ikee worm.
If your iPhone's battery life has been strangely short lately, your iPhone might have the third worm, which is constantly running a background process that attempts to spread itself to other vulnerable iPhones. Also, if you tried to and it didn't work, you most likely have this worm--it changes the default ssh password once it infects your iPhone.
iPhone/Privacy.A is the trickiest one to identify because it doesn't leave anything iPhone itself. Rather, it can be installed on a computer (a display model at a retail store, for example) and instructed to scan all available wireless networks for vulnerable iPhones. Your anti-virus software should catch it if it's on your computer, but you'll want to change the root password for your iPhone so it can't get in.