Welcome @Mark Reeves,
Please add your exact installed versions of Alfred, macOS, and KeePassXC.
Alfred doesn’t have a reason to switch your app if you’re opening it with the regular method, because all Alfred does is ask macOS to open the app. By the time the app opens, Alfred is no longer involved. But maybe you have a workflow which opens the app and then does something else, or a trigger somehow activated by some combination of characters, or something of the like. Note also that there are many people who use both apps, but this is the first time I remember seeing the error, so there’s also the possibility that some third thing on your machine is causing the problem. The next step is to figure out the reproduction steps exactly, which is why knowing the versions is imperative.
For example, what I’d recommend you do next is launch KeePassXC but not start typing your password. See if it switches then. If it doesn’t, that’s another clue. Then start typing your password slowly. Does it always switch back after two characters, or is it after a set amount of time, or something else? Those are the kind of things to be on the look out for to find the exact issue.