Health effect of worm in Guava
It is a safe bet that a "worm" as you describe in a ripe guava or any other ripe sweet fruit is a fruit fly.  


from http://www.greenharvest.com.au/PestControlOrganic/Information/FruitFlyControl.html

Fruit flies are attracted to any ripe sweet fruit.  They are also attracted to vinegar and alcohol - both produced by yeast in and on the fruit, which is the high protein food that the fruit flies are really after in the fruit. 

from 
http://homeguides.sfgate.com/treat-fruit-flies-guavas-30550.html


  When ripe, guavas emit a pungent, musky odor that attracts fruit
  flies. Fruit flies lay their eggs beneath the fruit's skin, and the
  maggots feed on the flesh. The damage causes guavas to rot. Fruit fly
  infestations often spread quickly, but prompt treatment can get
  populations under control.


The fly large actually speed the rotting of the fruit by moving yeast around on their bodies.