I realized I made a mistake after my paper was accepted for publication
This kind of error won't affect acceptance. Chances are you'll simply get to fix it during copyediting/typesetting. An eagle-eyed production editor might notice you are changing nontrivial aspects of the paper and confirm with the editorial board that the change is OK, but if the error is as simple as you describe, there's nothing to worry about.
If you had noticed this after the publication process is completed, then you'll probably have to issue an erratum/corrigendum.