Robotic object manipulation requires knowledge of the environment's state. In particular, the object poses of fixed elements in the environment relative to the robot and the in-hand poses of grasped objects are of interest. For insertion tasks with tight tolerances, the accuracy of vision systems to estimate the object and in-hand pose is not high enough. This work proposes a state estimation system that delivers precise estimates for both estimation problems. It uses contact detections and the precise forward kinematics that robot arms provide thanks to their high-resolution joint encoders. We propose a reinforcement-learning-based exploration strategy that decides how the robot should engage with the environment to reduce state uncertainty. The system is evaluated in several simulation and hardware experiments. We show that the learned policy can propose meaningful actions for object localization. In hardware experiments with precision-milled objects, sub-millimeter accuracy is achieved for the in-hand pose estimation task. With objects relevant to industrial tasks, i.e., a melting fuse and a fuse box, millimeter-level accuracy can be reached for both in-hand pose estimation and fixed object localization. In an integrated experiment, we show how a robot grasps a fuse, estimates the in-hand pose, and inserts it into a fuse box.