I have done this on several occasions, both while burying squadron mates and friends / relatives. This is my opinion, but reinforced by the Service Etiquette Manual, as well as the Fleet Forces Command Protocol Officer.
If it is a funeral for someone dying in the line of duty and you are part of a squadron / unit, and will be in ranks, all members will wear the same seasonal uniform (probably Choker White w/ ribbon or SDB w/ Ribbon).
If you are part of the burial party (pallbearer, reader, bugler, chaplain), you will probably wear Full Dress seasonal (Chokers or SDB w/ large medals) and gloves.
If you are a guest attendee, and not part of a larger military organization, it is most appropriate to wear Dress Blue as it is most similar to civilian mourning colors. Whether you choose to wear Full Dress (medals & gloves) or Service Dress (ribbons) is really a personal preference based on your relationship to the deceased, or other attendees.
For example, my next door neighbor was a retired Master Chief (AMCM) who recently died. His grandson was a Marine Second Lieutenant awaiting Flight School. The widow asked if I would be an honorary pallbearer and if I would wear my uniform. The 2Lt and I contacted each other and I asked him what he wanted to wear (medals) and followed his lead so we looked as similar as possible.
You should also get smart on when to salute, and maybe even get a good understanding of the traditions associated w/ a military funeral w/ burial detail, gun salute, taps, and folding / presentation of the flag, because at the wake or post funeral gathering, you will be asked many questions and should be able to explain the meanings, numbers, etc of those traditions.