The larger the hydrocarbon group attached to a typically water soluble functional group, the less water soluble it will be. For example, alcohols - -OH groups lead to water solubility, and methanol, ethanol, and propanols are miscible in water. The butanols and pentanols are less water soluble, and by the time you get to octanol, it is totally insoluble.
The measure you are looking for is the partition coefficient - this is a measurement of the compound's relative solubility in water and in octanol. It is usually reported as logP. If logP = 1, then the compound will be equally dissolved in water and octanol, >1 is more in the octanol (hydrophobic), and <1 is more in the water (hydrophilic).
The solubility changes with pH because the functional groups change with pH. In your phenol example - phenol can easily be extracted from water, but if you raise the pH, the phenol is deprotonated and becomes much more water soluble. You can extract phenol from an organic solvent using dilute sodium carbonate, and back-extract it into an organic solvent by acidifying the aqueous solution. The same for carboxylic acids - hexanoic acid isn't soluble in water, but it is soluble in a dilute aqueous base. Amines go the other direction - larger amines are not soluble in water, but are soluble in dilute aqueous acids. You can control which layer these types of molecules go to by controlling the pH of the aqueous layer.
I hope some of this helps.