We investigate the efficient generation of low-divergence high-order harmonics driven by waveform-optimized laser pulses in a gas-filled hollow waveguide. The drive waveform is obtained by synthesizing two-color laser pulses, optimized such that highest harmonic yields are emitted from each atom. Optimization of the gas pressure and waveguide configuration has enabled us to produce bright and spatially coherent harmonics extending from the extreme ultraviolet to soft x rays. Our study on the interplay among waveguide mode, atomic dispersion, and plasma effect uncovers how dynamic phase matching is accomplished and how an optimized waveform is maintained when optimal waveguide parameters (radius and length) and gas pressure are identified. Our analysis should help laboratory development in the generation of high-flux bright coherent soft x rays as tabletop light sources for applications.