In this paper, we utilize the method of Heintze-Karcher to prove a "best" version of Heintze-Karcher-type inequality for capillary hypersurfaces in the half-space or in a wedge. One of new crucial ingredients in the proof is modified parallel hypersurfaces which are very natural to be used to study capillary hypersurfaces. A more technical part is a subtle analysis along the edge of a wedge. As an application, we classify completely embedded capillary constant mean curvature hypersurfaces that hit the edge in a wedge, which is a subtler case.