If they come from different repositories (i.e. backports,
unstable, experimental) you can set priorities in
/etc/apt/preferences.d/ -- read the man page for
apt_preferences, because it's not intuitive.
Package: *
Pin: release a=bookworm
Pin-Priority: 900
Package: *
Pin: release a=bookworm-backports
Pin-Priority: 50
Or you can set things per-package by name, or a variety of other
mechanisms.
-dsr-