GPIO (and therefor I2C) cannot be used at 5v. You will need to use a level shifter on the I2C lines if you want to run the board at 5v. Connections on Raspberry Pi Pico board, other boards may vary.
/* Example code to drive a 16x2 LCD panel via a I2C bridge chip (e.g. PCF8574) NOTE: The panel must be capable of being driven at 3.3v NOT 5v. The Pico GPIO (and therefore I2C) cannot be used at 5v.