We present the results from a search for gravitational-wave transients associated with core-collapse supernovae observed within a source distance of approximately 20 Mpc during the first and second observing runs of Advanced LIGO and Advanced Virgo. No significant gravitational-wave candidate was detected. We report the detection efficiencies as a function of the distance for waveforms derived from multidimensional numerical simulations and phenomenological extreme emission models. The sources with neutrino-driven explosions are detectable at the distances approaching 5 kpc, and for magnetorotationally driven explosions the distances are up to 54 kpc. However, waveforms for extreme emission models are detectable up to 28 Mpc. For the first time, the gravitational-wave data enabled us to exclude part of the parameter spaces of two extreme emission models with confidence up to 83%, limited by coincident data coverage. Besides, using ad hoc harmonic signals windowed with Gaussian envelopes, we constrained the gravitational-wave energy emitted during core collapse at the levels of 4.27×10−4 M⊙c2 and 1.28×10−1 M⊙c2 for emissions at 235 and 1304 Hz, respectively. These constraints are 2 orders of magnitude more stringent than previously derived in the corresponding analysis using initial LIGO, initial Virgo, and GEO 600 data.