How does ufw handle conflicting rules?

ufw does not "handle the conflicts" in any way, it just puts the rules into an iptables chain which follows the first-match policy.

So if a packet matches a rule which drops it, it will be dropped regardless of any other matching rules which may follow.