The first search for a heavy neutral spin-1 gauge boson (Z′) with nonuniversal fermion couplings produced via vector boson fusion processes and decaying to tau leptons or W bosons is presented. The analysis is performed using LHC data at s=13 TeV, collected from 2016 to 2018 with the CMS experiment and corresponding to an integrated luminosity of 138 fb−1. The data are consistent with the standard model predictions. Upper limits are set on the product of the cross section for production of the Z′ boson and its branching fraction to ττ or WW. The presence of a Z′ boson decaying to τ+τ− (W+W−) is excluded for masses up to 2.45(1.60) TeV, depending on the Z′ boson coupling to standard model weak bosons, and assuming a Z′→τ+τ− (W+W−) branching fraction of 50%.