Herein, we have rationally designed a three-dimensional (3D) hierarchical PANI/CdS nanocomposite and heterojunction photoanode system by a two-step process consisting of the hydrothermal and chemical route and demonstrated significantly enhanced visible light driven photocatalytic and photoelectrochemical (PEC) activity. PANI/CdS nanocomposite has exhibited a substantial ~8 fold enhancement in the photocatalytic activity for rhodamine B (RhB) degradation than that of CdS nanoflowers (NFs). Furthermore, the PANI/CdS photoanode has exhibited higher photocurrent density (~6.79 mA/cm2 at 1 V vs. Ag/AgCl) under visible light irradiation which is ~5 fold higher than that of pristine CdS. Moreover, the PANI/CdS photoanode has demonstrated ~4 fold enhancement in the IPCE than that of CdS. The improved photocatalytic and PEC activity of the PANI/CdS nanocomposite is attributable to the improved visible light photoresponse and faster charge separation and transportation by virtue of hierarchical morphology of CdS and formation of Type-II heterojunction which is also beneficial to inhibit CdS photocorrosion. The work presents a new paradigm for fabricating the 3D hierarchical inorganic/organic system based on photocatalyst/photoanode to collectively enhance light absorption, charge separation, and surface oxidation/reduction reactions for efficacious dual applications in RhB degradation and PEC water splitting.