We present simulations and analytic calculations of the electromagnetic microwave fields of coplanar waveguide (CPW) resonators in the vicinity of highly conducting metallic samples. The CPW structures are designed with the aim of investigating electron spin resonance (ESR) in metallic heavy-fermion systems, in particular YbRh 2 Si 2 , close to the quantum critical point. Utilizing CPW resonators for ESR experiments allows for studies at mK temperatures and a wide range of freely selectable frequencies. It is therefore of great interest to evaluate the performance of resonant CPW structures with nearby metallic samples. Here we study the microwave fields at the sample surface as a function of sample distance from the waveguide structure and analyze the implications of the sample on the performance of the resonator. The simulation results reveal an optimum sample distance for which the microwave magnetic fields at the sample are maximized and thus best suited for ESR studies.