How to fix the «Unable to serialize value» error while upgrading Magento to 2.3.1?

The error could be related to the Redis caching.
In this case, you can fix it by deleting the Redis cache:

redis-cli FLUSHALL

02