Light cruisers seem to have a clear purpose in fleet design but I'm struggling to understand what heavy cruisers role was meant to be other than to hunt & sink light cruisers.
BLUF: IJN in the interwar period tended to favor heavy cruisers due to it matching their doctrine of attritional night engagements utilizing nighttime gunnery and torpedoes... both of which were more effective on heavy cruisers. The USN in the interwar period tended to favor light cruisers due to longer range and better fleet support for what was perceived to be a carrier/airplane dominated war.
I'll place some artificial restrictions on this given the interwar period encompasses the Washington and London Naval Treaties which themselves set the stage for early war engagements between navies, particularly the USN and IJN in cruiser engagements, so I'll focus on those.
The Washington Naval Treaty in 1922 laid out, for cruisers, that they should be restricted to 10,000t and 8"/203mm caliber gun maximum. In 1922, there weren't really "light" and "heavy" cruisers... just filling a void between destroyers and battlecruisers. The London Naval Treaty in 1932 specifically set forward hardline definitions of what a Light Cruiser is and what a Heavy Cruiser is. Both were limited to 10,000t and a Light Cruiser could not have any armament above 6.1"/155mm and a Heavy Cruiser could not go above 8"/203mm.
The London Naval Treaty also directed that there would be tonnage limitations on the cruiser class, both heavy and light, for each primary nation. It set forward:
Additionally, before jumping into doctrine, a significant point must be emphasized and that is the enormous gulf, if not ocean, of difference between US and Japanese torpedoes. The IJN had by far the best torpedo of the war and the generic differences are as follows:
Type 93 IJN Torpedo (2700kg with a 490kg warhead):
Mark 15 USN Torpedo (1700kg with a 224kg warhead)
As can clearly be seen, the long lance at its closest range was able to be launched at higher speeds than the USN equivalent. However, it should be noted that the IJN only officially declared the Type 93 was capable of an 11,000m range at 78km/h. This is a very important point for later.
Since Japan could not equal the USN in tonnage or number of cruisers, doctrinally for both the heavy and light cruisers the IJN typically focused on two things: night gunnery and torpedo attacks. The long lance torpedo was without a doubt the best torpedo of the war, clearly displayed in the above section. It was capable of being launched well outside of spotlight distance and at a speed of almost 90km/h and at night, it was capable of hitting ships even with lookouts before they would know they're being engaged.
Therefore, Japan focused their doctrine on night fighting with a significant number of destroyer/cruiser engagements anticipated early on until a final pivotal battle could be forced between capital ships. This is why, simply put, there wasn't really a space for a light cruiser in the IJN Doctrine of the 1930s so they did away with them. The IJN built and commissioned 10 heavy cruisers, all well above London Treaty limits, without commissioning a single light cruiser in the 1930s.
For the IJN there was a 17 gap between light cruisers from the Yubari in 1923 to the Katori in 1940. Even then the Katori-class were intended to be trainers and the IJN didn't commission a fleet CL until 1942 with the Agano-class which were intended to be "destroyer flagships".
The USN went about cruiser design almost completely differently. The USN fleet doctrine itself knew about it's own short-comings, identified through a series of "Fleet Problems". Fleet Problem XIII in 1932 showed that US fleet arrays were woefully unprepared for night engagements given a destroyer was able to come within 500m of a carrier before being spotted. This is beyond being within kill range even for a US torpedo. Fleet Problem XV tried to rectify this by pushing out the destroyer screen to 13km, but most ships within the fleet weren't able to tell friend from foe at that distance. Eventually, doctrine described a middle ground of 6km for an effective screen to allow the "fleet" to identify potential attackers and react.
Additionally, the USN doctrine (USN War Instructions FTP 143, 1934) specifically warned against night action for cruisers because of Fleet Problem issues laid out and the general consensus with the USN that Japan would intend to engage in a nighttime war of attrition and slowly whittle away the superior numbers of the US fleet.
Therefore, in the interwar period, the US more so focused on light cruisers that would be armed roughly equivilant to a destroyer in caliber but with about 10x the number of guns and far more AA capabilities. Like the IJN abandoned the light cruiser, the US abandoned the heavy cruiser. The New Orleans class was a complete mess of "trying to do too much not well at all". It was an 8" armed cruiser with a decent belt but was top heavy, again due to limitations in weight with poor maneuverability and a highly exposed aircraft hanger amidship.
The USN laid down 1 CA, the Wichita-class (1 ship), in the 10 years leading up to the war and that was essentially a heavy cruiser prototype attempting to do with 9 8" guns what the Brooklyn-class was able to do with 15 6" guns. The US laid down 9 Brooklyn-class and 9 Cleveland-class light cruisers before the war started.
Traditionally, cruisers have had two main duties. The first was as a fleet scout and escort, the second was on the sea-lanes, either raiding the enemy's merchant shipping or protecting it. The heavy cruiser filled both roles doctrinally. This answer will cover the development of the heavy cruiser in British doctrine; I'll leave other navies to those more familiar with them.
The Royal Navy's first 'heavy' cruisers (and arguably the world's first) were the Hawkins class cruisers, laid down in 1917 but completed in the years following WWI. These were an outgrowing of a pre-war design for a 'big' cruiser often dubbed the 'Atlantic cruiser'. As its name suggests, this ship was primarily intended to operate away from the fleet in the trade protection role. The large size made it more seaworthy and gave it more space for machinery than smaller cruisers, meaning it could be faster than any smaller raider. Its heavy armament of 7.5in guns would let it outgun most raiders. It was not intended for fleet work, to the point where a 7.5in armour-piercing shell was not developed, as it was only expected to fight smaller, more lightly armoured raiders. The Hawkins class was a development of these pre-war designs to match the RN's wartime experience. The new ships were armed with seven 7.5in guns, with a secondary battery of ten 12pdr guns, for anti-destroyer and anti-aircraft work. They displaced 9,750 tons, and could make up to 31 knots. When completed, they were the most powerful cruisers in the world.
However, they would not stay that way for long. The American and Japanese navies were already hard at work on similarly large cruisers armed with 8in guns, and there was information that the French were thinking similarly. This posed a major threat to British interests. Britain was heavily dependent on its maritime trade. These new large cruisers could easily sweep aside many existing British cruisers, and prey on Britain's trade. They would also make it impossible for Britain to do the same to its enemy's trade. A cruiser arms-race threatened, but was swiftly brought to an end by the Washington Treaty of 1921. The Washington Treaty limited new cruisers to a maximum tonnage of 10,000 tons, and a maximum armament of 8in guns. However, the British were unable to achieve one of their key goals, limiting the total number of cruisers.
Following Washington, and the breaking of the Anglo-Japanese Alliance, the RN began work on a new 8in cruiser to match those being built abroad. The design was heavily influenced by the strategic shift away from alliance with Japan. Britain had significant interests in the Far East, which the Japanese navy could pose a major threat to. Britain could not maintain a battlefleet in the Far East. Instead, local forces (primarily cruisers) would need to fight a delaying, harassing action in the South China Sea until the battlefleet could arrive from its bases in Europe. This imposed certain qualities on the new cruiser. It needed to have the range to patrol the sea lanes between Japan and Hong Kong or Singapore. It had to have the armament to engage enemy cruisers and be capable of acting as a scout for the battlefleet - the British did not know how the Japanese would use their heavy cruisers, so their British equivalent would have to be capable of operating in both situations. The result was the 'County' class (technically three related sub-classes), armed with eight 8in guns.
The Counties were capable ships, but were also expensive. Given the extent of British trade lines, the RN's strategic planners calculated that the fleet would need seventy cruisers. However, Britain could not afford to build Counties in sufficient volume to make a modern seventy cruiser fleet viable. A cheaper 8in cruiser was needed to cover the sealanes, letting the more capable Counties stay with the fleet or protect shipping in more threatened areas. This resulted in the two ships of the York class, armed with six 8in guns.
The Yorks were the last British heavy cruisers to be built. Part of this was down to exercise reports. Fleet exercises in the late 1920s found that the Hawkins class, the only heavy cruisers taking part in the exercises, were less suitable for fleet duties than light cruisers. The more manoeuvrable and faster-firing light cruisers were more able to repel enemy destroyer attacks or support light forces in night attacks. This reduced the desire to have 8in cruisers with the fleet. The First London Naval Treaty, signed in 1930, put limits on the number of heavy cruisers in service with the major naval powers. Not only did this prevent the RN building more heavy cruisers, it also reduced the threat to Britain's merchant fleet. Britain no longer needed large amounts of heavy cruisers, because nobody else was allowed to build large amounts of them. Instead, 6in cruisers would suffice to protect the trade routes.
In the latter half of the 1930s, cruiser sizes began to creep back up again. The First London Treaty had a fairly major loophole; it limited the number of 8in cruisers but not the number of 6in cruisers, while the 10,000 ton limit from Washington was still in effect. This meant that, especially with the development of triple 6in turrets, a navy could achieve similar capabilities to a heavy cruiser by building a 10,000 ton 6in cruiser. The Japanese were the first to do so with the Mogami class, with the USN following suit with the Brooklyn class. The RN needed to counter these, especially for trade protection. The result was the 'Town' class cruisers, armed with twelve 6in guns (again, this is technically a mix of three subclasses). The Second London Treaty of 1936 attempted to close this loophole, by decreasing the cruiser tonnage limit to 8000 tons. This was ineffectual; the British were able to cut the tonnage of the 'Town's down to 8000 tons to produce the 'Crown Colony' class, while the Japanese and Americans largely ignored the limit. These two classes don't really count as heavy cruisers, being armed with 6in guns, but their size and capabilities put them into the same weight class.
By the start of WWII, the RN's 8in cruisers were primarily seen as being most useful for commerce protection. This was a role they easily fell into. In October 1939, after it became clear that there were German commerce raiders at sea, eight hunting groups were formed, combining British and French ships. These eight groups included eight of the RN's fifteen 8in cruisers. Two of the forces were composed of two British 8in cruisers, a third added in the carrier Eagle, and a fourth had two 8in cruisers and two 6in cruisers. This last one found significant fame in December 1939, when it engaged the German large cruiser Graf Spee at the Battle of the River Plate - though one of the 8in cruisers, Cumberland, had been detached for a boiler cleaning and repairs and so missed the battle. Other 8in cruisers were engaged in patrolling the sealanes hunting for German shipping, both in the waters around the UK and further afield. They continued in these roles throughout the war. On Christmas Day 1940, HMS Berwick fought a brief action with the German cruiser Hipper, warding the German cruiser away from convoy WS5A. In December 1943, Norfolk joined the 6in cruisers Sheffield and Belfast to cover the convoys JW55B and RA55A, and as such was a significant component of the sinking of the Scharnhorst. Other ships hunted down raiders (and their supply ships) more directly. The auxiliary cruiser Atlantis was sunk by Devonshire, while her supply ship Python was sunk by Dorsetshire a few days later.
Some 8in cruisers did operate with the fleet, but this was rarer, with the big 6in cruisers being preferred for this work - these ships were more modern and more suited to the demands of fleet work. Suffolk and Norfolk did sterling work during the Bismarck campaign, shadowing the German battleship - though these two ships were already on patrol in the Denmark Strait when she sortied. Dorsetshire would also join in the final battle, but she had been detached from the escort for convoy SL74. Berwick formed part of the cruiser screen for the Mediterranean Fleet during the Battle of Cape Spartivento. Dorsetshire and Cornwall were part of Somerville's screen in the Indian Ocean during the Japanese raid, but both would be sunk after being detached from the screen to take up independent roles (Cornwall to escort a convoy, and Dorsetshire for a refit). However, in both of these cases, these ships were operating in theatres that were seen as relatively less important.
Other ships operated independently against Axis warships, or as a significant component of independent forces. Suffolk would be heavily damaged by German bombers after bombarding the airfield at Stavanger on the 17th April 1940. York supported the 6in cruiser Ajax during the Battle of Cape Passero. Exeter was a major part of the doomed ABDA fleet during the Java Sea campaign in early 1942. During the Battle of the Coral Sea, the Australia was part of a surface force protecting the approaches to New Guinea. Her sister ship Canberra would be sunk while on patrol near Guadalcanal during the Battle of Savo Island.
The 8in cruisers had a varied set of roles throughout the war, but this was not a significant divergence from pre-war doctrine. The cruiser was a swiss-army knife of a ship, and was expected to be capable of performing many tasks. The trade war was probably the most important role available, and one they had been initially designed to be most suited for. As such, it's no surprise that it was the one they carried out most.