Xcode 3.1.4 is the latest version that runs on 10.5. Xcode 3.1 can create universal binaries that run on Intel Macs.
Whether or not the binary you create in Xcode 3.1 runs in Mavericks depends on your code. Avoid using deprecated APIs, such as QuickDraw, and your binary should run on Mavericks.