The length of a rectangle is 3 m longer than its width. If the perimeter of the rectangle is 36 m, find its length and width.