When my check engine light went on why did my gas gauge stop working? on 2007 Chrysler Pacifica

Happened yesterday while driving. First the check engine light went on and immediately my gas gauge failed. The tank is almost full.

Asked by for the 2007 Chrysler Pacifica
could be the level sensor in the tank it failed causing the check engine light to turn on.