\Drupal\Core\Access\AccessResult was changed to follow a common pattern for collecting caching metadata about its dependencies. AccessResult used to have the following two methods for adding cache metadata from an entity or configuration: AccessResult::cacheUntilEntityChanges(), AccessResult::cacheUntilConfigurationChanges(). Both are deprecated and will be removed in Drupal 9.
Use the newly added AccessResult::addCacheableDependency(\Drupal\Core\Cache\CacheableDependencyInterface|mixed $other_object) instead. This method will add additional cache metadata to the access result based on the passed $other_object. If CacheableDependencyInterface is not implemented by $other_object, the object is assumed uncacheable, and therefore a max-age 0 is set.
This change will be further solidified in #2526326: Update CacheableMetadata & AccessResult to use RefinableCacheableDependency(Interface|Trait).