Why is my gas gauge glitching?

I have a 2004 Honda Civic, so when I went to fill up the gas tank a couple weeks ago, a few hours later, it was showing that I was halfway between full and half. Then it went back to normal a while later back at the full point. Then today, I was at the halfway point between half and empty. Then when I looked at it, it was showing that I was close to the gas light coming on and then when I looked again, it was back at the halfway point. What's the problem?

There are two aspects of this question. First, the question "why." What is the point of asking why as to anything mechanical when there's not point? Fuel measuring components of a car are complex and work depending on the engineering as designed by the manufacturer. Only a mechanic can repair this item. Just do like most people and explain the issue to a trained, certified and experienced mechanic and allow that mechanic to repair the vehicle. You pay the bill and drive into the sunset. If you care to know "why" then that very mechanic shall explain it to you.

The fuel float (which registers on the dash) is connected to the fuel pump in the gas-tank.

This Is Most Likely Causing The Problem.Why is my gas gauge glitching - 1

Fuel sender. At the top of your tank. You can get to it from the backseat or the trunk.