Yes you certainly can. First the clean dirt, bark and other
detritus off of rocks and wood. Then boil, boil, boil them. boil the wood for several hours, empty the water and start over until the water boils clear. The tannins from the wood will color the water in your tank if you don't, also you want to get your wood HOT all the way through to kill any nasties that might be hiding in it.
The rocks are easier, they too need to be boiled. Please be careful taking them out of the water as they can explode if cooled too fast or added to the next pot of cold water while their still hot.
also wood such as cedar, spruce etc, any that have a resinous smell are are unsuitable for wood in the tank.they have substances that can harm your fish if put in the tank. Hope that helps.
Carol